#include<bits/stdc++.h>
#define int long long
#define fi first
#define se second
#define mp make_pair
using namespace std;
auto IN = freopen("duela.in", "r", stdin);
auto OUT = freopen("duela.out", "w", stdout);
auto mread = [](){int x;scanf("%lld", &x);return x;};
const int N = 1e6 + 5;
int n = mread(), a[N];
map<int, int> ap;
priority_queue<int> q;
signed main(){
for(int i = 1; i <= n; i ++){
cin >> a[i];
ap[a[i]] += 1;
}
for(auto t : ap){
q.push(t.se);
}
int ans = 0;
while(q.size() >= 2){
int x = q.top();
q.pop();
int y = q.top();
q.pop();
ans += 2 * min(x, y);
if(x != y){
q.push(abs(x - y));
}
}
printf("%lld\n", n - ans);
return 0;
}