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 <iostream>
#include <vector>
#include <algorithm>

using namespace std;

int main()
{
    long long a,b;

    cin>>a;
    vector<long long> w(a);
    for(int i=0;i<a;i++){
        cin>>b;
        w[i]=b;
    }
    sort(w.begin(),w.end());
    cout<<a<<" ";
    for(int j=1;j<a;j++){
        int c=0;
        
        for(int i=0;i<a-1;i++){
            if(w[i]==w[i+j]){
                c+=(j+1);
                i+=j;
            }

        }
        cout<<c<<" ";
    }

    return 0;
}