1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
from collections import Counter

n = int(input())
s = [int(x) for x in input().split()]

groups = sorted(list(Counter(s).values()), reverse=True)
res = 0
a, b = 0, len(groups) - 1
while a <= b:
    cur = 0
    while b > a:
        if cur + groups[b] >= groups[a]:
            groups[b] -= groups[a] - cur - 1
            break
        cur += groups[b]
        b -= 1
    res += 1
    a += 1

print(res)