#include<iostream>
#include <vector>
#include <map>
#include<algorithm>
using namespace std;
map<int,int> wyst;
map<int, int, greater<int>> sor;
vector<pair<int,int>> tab;
vector<int> sum;
int main() {
	ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
	int liczba, el, suma;
	bool do_konca;
	cin >> liczba;
	
    for (int i=0; i < liczba; i++) {
		cin >> el;
        wyst[el]+=1;
	}
    for (auto i: wyst)
		sor[i.second]+= 1;
    for (auto i: sor)
		tab.push_back(i);
	suma = 0;
	sum.push_back(suma);
	for (auto i: tab) {
		suma+= (i.first*i.second);
		sum.push_back(suma);
	}
	// for (auto i: sum)
		// cout << i << " ";
	// cout << " koniec\n";
		
	suma = liczba;
	cout << suma << " ";
	for (int w = 2; w <= liczba; w++) {
		suma = liczba;
		do_konca = true;
		for (int l=0; l < tab.size(); l++) {
			// cout << w << " w " << l << " l \n";
			if (tab[l].first < w) {
				cout << suma - liczba + sum[l] << " ";
				do_konca = false;
				break;
			}
			suma -= ((tab[l].first%w)*tab[l].second);
		}
		if (do_konca)
			cout << suma << " ";
	}
	// for (auto i: tab)
		// cout << i.first << " " << i.second << " | ";
	// cout << " koniec\n";
	cout << "\n";
	return 0;
	
}
        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 57 58 59 60 61 62 63 64 65 66  | #include<iostream> #include <vector> #include <map> #include<algorithm> using namespace std; map<int,int> wyst; map<int, int, greater<int>> sor; vector<pair<int,int>> tab; vector<int> sum; int main() { ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); int liczba, el, suma; bool do_konca; cin >> liczba; for (int i=0; i < liczba; i++) { cin >> el; wyst[el]+=1; } for (auto i: wyst) sor[i.second]+= 1; for (auto i: sor) tab.push_back(i); suma = 0; sum.push_back(suma); for (auto i: tab) { suma+= (i.first*i.second); sum.push_back(suma); } // for (auto i: sum) // cout << i << " "; // cout << " koniec\n"; suma = liczba; cout << suma << " "; for (int w = 2; w <= liczba; w++) { suma = liczba; do_konca = true; for (int l=0; l < tab.size(); l++) { // cout << w << " w " << l << " l \n"; if (tab[l].first < w) { cout << suma - liczba + sum[l] << " "; do_konca = false; break; } suma -= ((tab[l].first%w)*tab[l].second); } if (do_konca) cout << suma << " "; } // for (auto i: tab) // cout << i.first << " " << i.second << " | "; // cout << " koniec\n"; cout << "\n"; return 0; }  | 
            
        
                    English