1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
#include<bits/stdc++.h>

using namespace std;

const int N = 3e5 + 5;
int n = 0, ans[N] = {};
map<int, int> c;

int main(){
	scanf("%d", &n);
	for(int i = 1, x = 0 ; i <= n ; i ++){
		scanf("%d", &x);
		c[x] ++;
	}
	for(auto bag : c){
		int m = bag.second;
		for(int i = 1 ; i <= m ; i ++) ans[i] += m / i;
	}
	for(int i = 1 ; i <= n ; i ++) printf("%d ", ans[i] * i);
	return 0;
}