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
#include <bits/stdc++.h>

using namespace std;

vector<int>g;
vector<int>ans;


int main()
{
    int n,a,counter=0,pop=-1;
    cin>>n;
    for(int i=0;i<n;i++)
    {
        cin>>a;
        g.push_back(a);
    }
    sort(g.begin(),g.end());
    for(auto v:g)
    {
        if(v!=pop)
        {
            ans.push_back(counter);
            counter=0;
        }
        counter++;
        pop=v;
    }
    ans.push_back(counter);
    sort(ans.begin(),ans.end());
    reverse(ans.begin(),ans.end());
   // for(auto v:ans)cout<<v<< " ";
   // cout<<endl;
    for(int i=1;i<=n;i++)
    {
        int suma=0;
        for(auto v:ans)
        {
            if(v<i)break;
            suma+=v-v%i;
        }
        cout<<suma<<" ";
    }
}