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
49
50
51
52
53
54
55
56
// Mateusz Lambert
#include <iostream>
#include <vector>
#include <map>
#include <unordered_map>
#include <queue>
#include <set>
#include <unordered_set>
#include <climits>
#include <algorithm>
#define ll long long
#define int128 __uint128_t
#define pb push_back
#define all(x) (x).begin(), (x).end()
#define vi vector <int>
#define si set <int>
#define sl set <ll>
#define mins(x) *x.begin()
#define maxs(x) *x.rbegin()
#define vii vector <pair<int, int>>
#define vl vector <ll>
#define vll vector<pair<ll, ll>>
#define vb vector <bool>
#define vs vector <string>
#define pii pair<int, int>
#define pll pair<ll, ll>
#define sec second
#define fir first
using namespace std;

const int MAXN = 3e5+1;
int res[MAXN];

int main(){
	ios_base::sync_with_stdio(0);
	cout.tie(0);
	cin.tie(0);
	
	unordered_map<int, int> occs;
	int n; cin >> n;
	for (int i=0; i<n; i++){
		int x; cin >> x; occs[x]++;
	}
	vi occ;
	for (auto [a, b] : occs) occ.pb(b);
	sort(all(occ), greater<int>());
	
	for (int i=0; i<occ.size(); i++){
		for (int j=occ[i]; j>=1; j--){
			if (occ[i]%j==0) res[j] += occ[i];
			else res[j] += occ[i]-occ[i]%j;
		}
	}
	for (int i=1; i<=n; i++) cout << res[i] << ' ';
	cout << '\n';
}