
#include <bits/stdc++.h>
using namespace std;
typedef long long LL;
const int N = 2e5+5;

int n,c, t, now, x;

int main() {
    scanf("%d",&t);
    while(t--) {
        priority_queue<int>pq;
        c = 0;
        map<int, int>mp;
        scanf("%d",&n);
        for(int i = 1 ; i <= n; i++) {
            scanf("%d",&x);
            mp[x]++;
        }
        for(auto i :mp)
            pq.push(i.second);
        while(pq.size() > 1) {

            int f1 = pq.top() - 1 ;
            pq.pop();
            int f2 = pq.top() - 1;
            pq.pop();
            if (f1)pq.push(f1);
            if (f2)pq.push(f2);
        }
        printf("%d\n",pq.size() ? pq.top():0);
    }

    return 0;
}
