#include <bits/stdc++.h>
using namespace std;
#define int         long long int
#define rep(i,a,b)  for (int i = a; i < b; ++i)
#define rrep(i,z,a) for (int i = z; i >= a; --i)
#define rep0(n)     for(int i = 0 ; i < n; ++i )
#define rep1(n)     for(int i = 1 ; i <= n; ++i )
#define tc          int test;cin>>test; while(test--)
#define all(v)      v.begin(),v.end()
#define pb          push_back
#define ff          first
#define ss          second
#define mp          make_pair
#define endl        "\n"
#define maxn        998244353
#define mod         1000000007
#define kill(x)     return cout<<x<<endl,0
//#define ll          long long int
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<pii> vii;
int cases = 1;
int solve()
{
	int n;
	cin >> n;
	int a[n];
	map<int, int> h;
	rep0(n)cin >> a[i], h[a[i]]++;
	set<pair<int, int>> s;
	for (auto ch : h)s.insert({ -ch.ss, ch.ff});
	int ans = n;
	while (s.size() >= 2)
	{
		pii cnt1 = *s.begin();
		s.erase(s.begin());
		pii cnt2 = *s.begin();
		s.erase(s.begin());
		cnt1.ff++;
		cnt2.ff++;
		if (cnt1.ff)s.insert(cnt1);
		if (cnt2.ff)s.insert(cnt2);
		ans -= 2;
	}
	kill(ans);
	return 0;
}
signed main()
{
	ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#ifndef ONLINE_JUDGE
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
#endif
	tc
	// cout << "Case #" << cases++ << ": ",
	solve();
	return 0;
}