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
#include<bits/stdc++.h>
using namespace std;
#ifdef DEBUG
auto&operator <<(auto& o, pair<auto, auto> p) {return o<<"("<<p.first<<", "<<p.second<<")";}
auto operator <<(auto& o, auto x)->decltype(x.end(), o) {o<<"{"; for(auto v : x) o<<v<<", "; return o<<"}";}
#define debug(X) cout<<"["#X"]"<<X<<endl;
#else
#define debug(X) {}
#endif
#define int long long
int32_t main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);
	int n;
	cin>>n;
	map<int, int> m;
	for(int i=0;i<n;i++) {int a; cin>>a; m[a]++;}
	vector<int> grp;
	for(auto v : m) grp.push_back(v.second);
	sort(grp.begin(), grp.end(), [&](int a, int b){return a > b;});
	int p = grp.size()-1;
	for(int i=1;i<=n;i++)
	{
		if(p >= 0)
		while(grp[p] < i) {p--; if(p < 0) break;}
		int sum = 0;
		for(int j = 0;j<=p;j++) sum += (grp[j] - grp[j]%i);
		cout<<sum<<" ";
	}
}