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
#include <bits/stdc++.h>
#pragma GCC optimize("Ofast,unroll-loops")
//#pragma GCC target("sse,sse2,sse3,ssse3,sse4,fma,abm,mmx,avx,avx2,tune=native")
#pragma GCC target("sse,sse2,abm,mmx,sse3,tune=native")
using namespace std;
typedef long long lld;
typedef pair<int, int> pii;
typedef pair<lld, lld> pll;
#define ff first
#define dd second
#define mp make_pair
#define pb push_back
#define sz size()
#define For(i, s, a) for(int i = s; i < a; ++i)
#define all(x) (x).begin(), (x).end()
#define make_unique(x) (x).erase(unique(all(x)), (x).end())


int main(void) {
    int n;
    scanf("%d", &n);
    map<int, int>c;
    For (i, 0, n) {
        int g;
        scanf("%d", &g);
        c[g]++;
    }
    vector<int> out(n + 1, 0);
    for (auto s : c) {
        For (i, 1, s.dd + 1) {
            out[i] += (s.dd / i) * i;
           //s cout << s.ff << " "<< i << " aha " << s.dd <<" " << (s.dd / i) * i <<endl; 
        }
    }
    For (i, 1, n + 1) 
        printf("%d ", out[i]);
}