1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
#!/usr/bin/env python3

import sys
from collections import Counter

import numpy as np


def main():
    n = int(sys.stdin.readline())
    c = Counter((int(s) for s in sys.stdin.readline().split()))
    r = np.arange(n) + 1
    out = np.zeros_like(r)
    c2 = Counter(c.values())
    for k, v in c2.items():
        rr = r[:k]
        out[:k] += k // rr * rr * v
    print(' '.join(map(str, out)))


if __name__ == "__main__":
    main()