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
#include <iostream>
#include <vector>
#include <algorithm>
#include <math.h>
#include <set>
#include <map>
#include <stack> 
#include <queue> 
#include <iomanip>              
using namespace std;
typedef long long ll;
const int N = 2e2 + 10;
const int P = 101;
const ll MLL = 1e18;
const ll mod = 998244353;
const ll LOG = 23;

void solve() {

	int n;
	cin >> n;
	vector<int> all(n + 1);
	for(int i = 0; i < n; i++) {
		int a;
		cin >> a;
		all[a]++;
	}
	vector<int> v;
	for(int i = 0; i <= n; i++) {
		if(all[i] > 0) v.push_back(all[i]);
	}
	sort(v.begin(),v.end());
	int l = 0;
	int r = v.size() - 1;
	int ans = 0;
	while(r >= l) {
		int val = v[r] - 1;
		while(val > 0 && r != l) {
			if(v[l] > val) {
				v[l] -= val;
				val = 0;
			}else {
				val -= v[l];
				l++;
			}
		}
		r--;
		ans++;
	}
	cout << ans << endl;
}

int main()
{
	ios_base::sync_with_stdio(false);
    cin.tie(0);
	
    solve();


    return 0;
}