#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define ld long double
#define FAST ios::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
#define mpr make_pair
#define pb push_back

const int MAX = 2*1e5 + 1;
int n, x;
	
int main(){
	FAST;
	
	int t = 1;
	cin >> t;
	while(t--){
		cin >> n;
		map<int, int> mp;
		for(int i = 0; i < n; i++){
			cin >> x;
			mp[x]++;
		}
		
		vector<int> dp;
		dp.reserve(n);
		for(auto it = mp.begin(); it != mp.end(); it++){
			dp.pb(it->second);
		}
		sort(dp.begin(), dp.end());
		
		int MX = dp.at(dp.size()-1), SM = 0;
		for(int i = 0 ; i < dp.size()-1; i++){
			SM = SM + dp[i];
		}
		
		int ans = n%2;
		if(MX > SM){
			ans = MX - SM;
		}
		
//		cout << "RESULT : ";
		cout << ans << endl;
	}
	
	return 0;
}

