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
from collections import Counter

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

coutner = sorted(Counter(seq).values())

result = []

start = 0

while len(result) < n:
    k = len(result) + 1

    stamps = 0

    for stamp_count in coutner[start:]:
        if stamp_count <= k:
            start += 1
        stamps += stamp_count - stamp_count % k
    
    result.append(stamps)
    
    if start >= len(coutner):
        result = result + [0] * (n - len(result))

print(' '.join(str(x) for x in result))