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
#include <bits/stdc++.h>
#define ll long long
#define fast ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
#define pb push_back
#define f first
#define s second
#define pii pair<int, int>
#define pll pair<ll, ll>
using namespace std;
const int N = 3e5+1;
unordered_map<int,int>cnt;
int znaczki[N];
int main(){
    fast
    int n;
    cin >> n;
    for(int i = 0;i < n;i++){
        int a;
        cin >> a;
        cnt[a]++;
    }
    for(auto a: cnt)
        for(int i = 1;i <= a.s;i++)
            znaczki[i] += a.s/i * i;

    for(int i = 1;i <= n;i++)
        cout << znaczki[i] << " ";
}