1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
#include<stdio.h>
#include<map>
#define N 300009
using namespace std;
inline char nc()
{
	static char buf[99999],*l,*r;
	return l==r&&(r=(l=buf)+fread(buf,1,99999,stdin),l==r)?EOF:*l++;
}
inline void read(int&x)
{
	char c=nc();for(;c<'0'||'9'<c;c=nc());
	for(x=0;'0'<=c&&c<='9';x=(x<<3)+(x<<1)+(c^48),c=nc());
}
int n,ans[N];map<int,int>mmp;
main()
{
	read(n);for(int i=n,x;i--;read(x),++mmp[x]);
	for(map<int,int>::iterator it=mmp.begin();it!=mmp.end();++it)
		for(int j=1;j<=it->second;++j)ans[j]+=it->second/j*j;
	for(int i=1;i<=n;printf("%d ",ans[i++]));
}