#include <bits/stdc++.h>
using namespace std;
int main() {
  long long m, n, i, t, j;
  cin >> t;
  while (t--) {
    long long one = 0, zro = 0, cnt = 0, ans = 0;
    cin >> n;
    vector<long long> v;
    for (long long j = 0; j < n; j++) {
      string s;
      cin >> s;
      for (long long i = 0; i < s.size(); i++) {
        if (s[i] == '1')
          one++;
        else
          zro++;
      }
      v.push_back(s.size());
    }
    sort(v.begin(), v.end());
    long long pr = one / 2 + zro / 2;
    for (long long i = 0; i < v.size(); i++) {
      long long need = v[i] / 2;
      if (need <= pr) pr -= need, ans++;
    }
    cout << ans << endl;
  }
}
