#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
//#include<cmath>
#include <queue>
#include <map>
//#include<bitset>
//#include <fstream>

#define ll long long int
using namespace std;

void Solve()
{
    int n;
    cin >> n;
    priority_queue<int>freq;
    map<int, int> temp;
    while(n--)
    {
        int x;
        cin >> x;
        temp[x]++;
    }
    for(auto& x: temp)
    {
        freq.push(x.second);
    }
    while(freq.size() > 1)
    {
        int a = freq.top();
        freq.pop();
        int b = freq.top();
        freq.pop();
        a--;
        b--;
        if(a) freq.push(a);
        if(b) freq.push(b);
    }
    if(freq.size())
        cout << freq.top();
    else cout << 0;
}

int main()
{
    ios_base::sync_with_stdio( false );
    cin.tie( nullptr );
    //freopen("in.txt", "r", stdin);
	//freopen("out.txt", "w", stdout);
	int t;
	cin >> t;
	while(t--)
    {
        Solve();
        cout << '\n';
    }
    return 0;
}
