#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
ll mod=1000000007;
#define inf 1e18
#define pb push_back
#define F first
#define S second
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0)
void appy()
{
    IOS;
    ll n,c=0,i=0,j;
    cin>>n;
    vector<ll>v(n,0);
    for(i=0;i<n;i++)
        cin>>v[i];
    sort(v.begin(),v.end());
    if(n&1) j=n/2+1;
    else j=n/2;
    i=0;
    while(j<n)
    {
        if(v[i]==v[j])
        {
            j++;
        }
        else 
        {
            i++;
            j++;
            c+=2;
        }
    }
    cout<<n-c<<endl;
}

int main()
{
    IOS;
    ll t;
    cin>>t;
    while(t--)
    {
        appy();
    }
    return 0;
}