#include<bits/stdc++.h>
using namespace std;

int main() {
  int t;
  cin >> t;
  while (t--) {
    int n; cin >> n;
    vector<int> a(101);
    for (int i = 0; i < n; i++) {
      int x; cin >> x;
      a[x]++;
    }
    int total = n;
    for (int i = 1; i <= 100; i++) {
      total += a[i] % 2;
    }
    total += total % 4;
    cout << total - n << '\n';
  }
  return 0;
}