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 ll long long
#define fi first
#define se second
#define pb push_back

map<int, int> ile;
int il[300009];

int main(){
	int n;
	cin>>n;
	for(int i = 1; i <= n; i++){
		int x;
		cin>>x;
		ile[x]++;
		/*
		for(int j = 1; j <= ile[x]; j++){
			if(ile[x] % j == 0) t[j] += j;
		}
		*/
		il[ile[x]]++;
		//il[ile[x] - 1]--;
	}
	for(int i = 1; i <= n; i++){
		int w = 0;
		for(int j = i; j <= n; j += i){
			w += il[j];
		}
		cout<<w * i<<" ";
	}
}