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
41
42
43
44
45
46
47
#include <bits/stdc++.h>
#define fi first
#define se second
using namespace std;
typedef long long ll;

const int N = 3e5+7;
int n, a[N];
map<int, int> cnt;

int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    
    cin >> n;
    for (int i=0; i<n; i++){
		cin >> a[i];
		cnt[a[i]]++;
	}
	vector<int> cur;
	for (auto ele : cnt){
		cur.push_back(ele.se);
	}
	sort(cur.begin(), cur.end());
	reverse(cur.begin(), cur.end());
	
	for (int k=1; k<=n; k++){
		while (!cur.empty() && cur.back() < k) cur.pop_back();
		int res = 0;
		for (auto i : cur){
			res += (i / k);
		}
		cout << res * k << ' ';
	}
	cout << '\n';
	
    return 0;
}
/*

9
1 1 777 42 777 1 42 1 777

18
9 9 9 9 9 9 9 9 9 6 6 6 6 6 6 3 3 3

*/