#include <bits/stdc++.h>
#pragma comment(linker, "/STACK:32100000")
#pragma GCC optimize("O3")
using namespace std;
int n;
int arr[128];
int sum[2];
void solve() {
  sum[0] = sum[1] = 0;
  cin >> n;
  for (int i = 0; i < n; i++) {
    string s;
    cin >> s;
    for (auto &j : s) {
      sum[j - '0']++;
    }
    arr[i] = s.size();
  }
  int ans = 0;
  sort(arr, arr + n);
  for (int i = 0; i < n; i++) {
    bool ok = 1;
    for (int j = 0; j < arr[i] / 2; j++) {
      if (sum[0] >= 2) {
        sum[0] -= 2;
      } else if (sum[1] >= 2) {
        sum[1] -= 2;
      } else {
        ok = 0;
      }
    }
    if (arr[i] % 2) {
      if (sum[0] > 0 && sum[0] % 2) {
        sum[0]--;
      } else if (sum[1] > 0 && sum[1] % 2) {
        sum[1]--;
      } else if (sum[0] > 0) {
        sum[0]--;
      } else if (sum[1] > 0) {
        sum[1]--;
      } else {
        ok = 0;
      }
    }
    if (ok) {
      ans++;
    }
  }
  cout << "" << ans << "\n";
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  cin.sync_with_stdio(0);
  cout.sync_with_stdio(0);
  cout.precision(9);
  srand(time(0));
  int q;
  cin >> q;
  while (q--) {
    solve();
  }
  return 0;
}
