/*********************/
//Hard work beats talent when talent doesn’t work hard
/*********************/
#include <iostream>
using namespace std;
#include<bits/stdc++.h>
#define int long long
#define wh while (t--)
#define pb push_back
#define  popcount __builtin_popcountll
#define beg begin()
#define endi end()
#define f first
#define sec second
#define endl '\n'
#define iso ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
//freopen ("text_file.txt", "w", stdout);
const int MOD =1e9+7 ;
int32_t main()
{
    iso ;
int t ;
cin>> t ;
while(t--)
{
   int n ;
   cin>>n ;
   int arr[n ] ;
   map<int,int>mp ;
   priority_queue<pair<int,int>>pq ;
    for (int i = 0; i <n ; ++i) {
        cin>> arr[i] ;
        mp[arr[i]]++ ;

    }
    for(auto pt :mp)
    {
        pq.push({pt.second ,pt.first}) ;
    }
    int ans =n ;
    while(pq.size()>=2)
    {

        auto pt =pq.top() ;
        pq.pop() ;
        auto pt2 =pq.top() ;
        pq.pop() ;
        ans-=2 ;
        pt.first -- ;
        pt2.first -- ;
        if(pt.first>=1)
        pq.push({pt.first,pt.second}) ;
        if(pt2.first>=1)
        pq.push({pt2.first,pt2.second}) ;

    }
    cout<<ans<<endl ;


}

}
