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
30
31
32
33
34
n = int(input())
a = list(map(int, input().split()))
d = {}

for ai in a:
    if ai in d:
        d[ai] = d[ai] + 1
    else:
        d[ai] = 1

c = list(d.values())
c.sort(reverse=True)

st = 0
e = len(c) - 1
count = 0
sum = 0
while st < e:
    if c[st] > sum + c[e]:
        sum += c[e]
        e -= 1
    else:
        count += 1
        st += 1
        sum = 0
        if st == e:
            count += 1

if sum > 0:
    count += 1
if len(c) == 1:
    count = 1

print(count)