1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
def lid(arr):
    d = {}
    for i in arr:
        d[i] = 1 + (d[i] if i in d else 0)

    sorted_values = sorted(d.values(), reverse=True)
    count = 0
    while len(sorted_values):
        count += 1
        current = sorted_values.pop(0)
        goal = current * 2 - 1
        while current != goal:
            if len(sorted_values) == 0:
                break
            last = sorted_values.pop(-1)
            if current + last > goal:
                sorted_values.append(goal - current)
                current = goal
            elif current + last == goal:
                current += last
            else:
                current += last

    return count


input()
numberList = [int(x) for x in input().split()]
print(lid(numberList))