def solution(nums):
answer = 0
nums_set = set(nums)
if len(nums_set) < len(nums)//2:
answer = len(nums_set)
else :
answer = len(nums)//2
return answer
참고 : https://school.programmers.co.kr/learn/courses/30/lessons/1845?language=python3