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
#include <bits/stdc++.h>
#define FOR(i,p,k) for(int i=(p);i<=(k);++i)
#define REP(i,n) FOR(i,0,(n)-1)
#define ssize(x) (int((x).size()))
#define all(x) (x).begin(),(x).end()
#define rall(x) (x).rbegin(),(x).rend()
#define gc getchar_unlocked
using namespace std;

void wczytaj(int &a){
	int c = gc();
	while(c < '0' || c > '9') c = gc();
	for(a = 0; c >= '0' && c <= '9'; c = gc()) a = 10*a+c-'0';
}

void solve(){
	int n;
	wczytaj(n);
	vector<int> kub(n, 0);
	REP(i, n){
		int a;
		wczytaj(a);
		++kub[a-1];
	}
	sort(rall(kub));
	int suma = 0, wyn = 0;
	while(suma < n) suma += (kub[wyn++]<<1)-1;
	printf("%d", wyn);
}

int main(){
	solve();
	return 0;
}