from collections import defaultdict


def solution(nums):
    answer = 0
    monster = defaultdict(int)
    for n in nums:
        monster[n] += 1
    monster_kind = len(monster)
    if len(nums) // 2 <= monster_kind:
        return len(nums) // 2
    else:
        return monster_kind

04e1b29d51c8a15674202917ba9accc3ad8e54b3
<mask token>

<mask token>


def solution(nums):
    answer = 0
    monster = defaultdict(int)
    for n in nums:
        monster[n] += 1
    monster_kind = len(monster)
    if len(nums) // 2 <= monster_kind:
        return len(nums) // 2
    else:
        return monster_kind

from collections import defaultdict


def solution(nums):
    answer = 0
    monster = defaultdict(int)
    for n in nums:
        monster[n] += 1
    monster_kind = len(monster)
    if len(nums) // 2 <= monster_kind:
        return len(nums) // 2
    else:
        return monster_kind
