#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define fi first
#define se second
const int N=2e5+1;
int n;
int a[N];
int f[N];
void solve(){
	cin >> n;
	for(int i=1; i<=100 ;i++) f[i]=0;
	for(int i=1; i<=n ;i++){
		cin >> a[i];
		f[a[i]]^=1;
	}
	int z=0;
	for(int i=1; i<=100 ;i++){
		z+=f[i];
	}
	while((n+z)%4!=0) z++;
	cout << z << '\n';
	
}
int main(){
	ios::sync_with_stdio(false);cin.tie(0);
	int t;cin >> t;while(t--) solve();
}