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
#include <iostream>
#include <vector>
#include <functional>
#include <algorithm>
using namespace std;


int main() {
	vector<int> lic;
	int n;
	cin >> n;
	lic.resize(n+1);
	for (int i = 0; i < n; ++i) {
		int x;
		cin >> x;
		lic[x]++;

	}
	sort(lic.begin(), lic.end(), greater<int>());
	int sum = 0;
	int cnt = 0;
	for (auto x : lic) {
		++cnt;
		sum += 2*x-1;
		if (sum >= n) break;
	}
	cout << cnt << endl;
	return 0;
}