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
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
def resolve_bigger_test(arr_in, n):
    arr = [int(elem) for elem in arr_in.split()]
    arr.sort()
    
    counters = [0] * int(n)
    count, max_count = 1, 0
    
    for idx, x in enumerate(arr):
        if idx == 0:
            continue
        
        if x == arr[idx-1]:
            count += 1
        else:
            counters[count-1] += 1
            if max_count < count:
                max_count = count
            count = 1
                
    counters[count-1] += 1
    if max_count < count:
        max_count = count
    
    nonzero = 0
    for idx in range(max_count):
        if counters[idx] > 0:
            nonzero += 1
            
    indexes = [0] * nonzero
    i = 0
    for idx in range(max_count):
        if counters[idx] > 0:
            indexes[i] = idx
            i += 1
            
    
    idx_cur = 0
    for i in range(int(n)):
        if i == 0:
            print(n, end=' ')
            continue
        
        sum = 0
        if idx_cur >= len(indexes):
            if i + 1 < int(n):
                print(sum, end=' ')
            else:
                print(sum)
            continue
        
        if indexes[idx_cur] < i:
            idx_cur =+ 1
            
        for j in range(idx_cur, len(indexes)):
            multi = (indexes[j] + 1) // (i + 1)
            sum = sum + (multi * counters[indexes[j]]*(i+1))
        
        if i + 1 < int(n):
            print(sum, end=' ')
        else:
            print(sum)

if __name__ == "__main__":
    n = input()
    arr_in = input()
    
    if int(n) == 1:
        print(1)
    else:
        resolve_bigger_test(arr_in, n)