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
48
//ANMHLIJKTJIY!
#pragma GCC optimize(2)
#pragma GCC optimize("Ofast")
#pragma GCC optimize("inline","fast-math","unroll-loops","no-stack-protector")
#pragma GCC diagnostic error "-fwhole-program"
#pragma GCC diagnostic error "-fcse-skip-blocks"
#pragma GCC diagnostic error "-funsafe-loop-optimizations"
#include <bits/stdc++.h>
#define INF 1000000000
#define LINF 1000000000000000000
#define MOD 1000000007
#define mod 998244353
#define F first
#define S second
#define ll long long
#define N 300010
using namespace std;
ll n,a[N],ans[N];
map<ll,ll> mp;
int main(){
	ll i,j,x;
	scanf("%lld",&n);
	for(i=0;i<n;i++)
	{
		scanf("%lld",&x);
		mp[x]++;
	}
	for(map<ll,ll>::iterator it=mp.begin();it!=mp.end();it++)
	{
		a[it->S]++;
	}
	for(i=1;i<=n;i++)
	{
		if(a[i])
		{
			for(j=1;j<=i;j++)
			{
				ans[j]+=a[i]*(i/j);
			}
		}
	}
	for(i=1;i<=n;i++)
	{
		printf("%lld ",ans[i]*i);
	}
	puts("");
	return 0;
}