#include <bits/stdc++.h>
using namespace std;
#define take(a,n) for(int I=0;I<n;I++) cin>>a[I]
#define show(a,n) for(int I=0;I<n;I++) cout<<a[I]<<" "; cout<<'\n'
#define bruh ios_base::sync_with_stdio(false); cin.tie(NULL)
#define ll long long
ll mod = 1000000007;
int main()
{
	bruh;
	ll T, i, j;
	cin>>T;
	while(T--)
	{
		int n;
		cin>>n;
		int a[n];
		take(a,n);
		map <int,int> lol;
		for(i=0;i<n;i++)
		lol[a[i]]++;
		auto it = lol.begin();
		int rofl = INT32_MIN;
		for(;it!=lol.end();it++)
		rofl = max(rofl,it->second);
		n%2==0?cout<<max(0,2*rofl-n)<<'\n':cout<<max(1,2*rofl-n)<<'\n';
	}
	return 0;
}
// zenith