1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
import numpy

city_number = {}
n = int(input())
arr = input().split(" ")
for i in arr:
    if i not in city_number:
        city_number[i] = 1
    else:
        city_number[i] += 1

numbers = []
for i in city_number:
    numbers += [city_number[i]]
numbers.sort()
numbers, counts = numpy.unique(numbers, return_counts=True)
numbers = numpy.array(numbers)

for i in range(1, n + 1):
    split = numbers.searchsorted(i)
    res = ((numbers[split:] - (numbers[split:] % i)) * counts[split:]).sum()
    print(res, end=" ")