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
#include<bits/stdc++.h>

using namespace std;

int n;
vector<int> const_add;
vector<int> result;
map<int, int> ile;
const bool _log = false;

int main(){
    
	ios_base::sync_with_stdio(0);cout.tie(0);cin.tie(0);
	
    cin>>n;

    const_add.assign(n + 2, 0);
    result.assign(n + 2, 0);

    for(int i = 0, v; i < n; ++i){
        cin>>v;
        ile[v]++;
    }

    for(auto p : ile){
        const_add[p.second + 1] += p.second;
        if(_log)cout<<p.second<<" - p \n";
        for(int i = 1; i <= p.second; ++i){
            result[i] += p.second%i;
        }
    }

    for(int i = 1; i <= n; ++i){
        const_add[i] += const_add[i - 1];
        cout<<n - (result[i] + const_add[i])<<" ";
    }
    cout<<endl;

	return 0;
}