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
#include <bits/stdc++.h>
using namespace std;
#define st first
#define nd second

const int MAXN = 3e5+7;
int ans[MAXN];
unordered_map<int, int> m;

int main(){
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);

	int n, x;
	cin >> n;

	for(int i = 0; i < n; i++){
		cin >> x;
		m[x]++;
	}

	for(const auto& [a, b] : m){
		for(int i = 1; i <= n; i++){
			if(b/i==0) break;
			ans[i]+=(b/i)*i;
		}
	}

	for(int i = 1; i <= n; i++) cout << ans[i] << ' ';
	cout << '\n';

	return 0;
}