#include <bits/stdc++.h>   using namespace std;   const long long MOD = (1 << 30);   const double Exp = 1e-8;   const int maxm = 1e5 + 7;   const int maxn = 1e5 + 7;   const int inf = 0x3f3f3f3f;   const long long INF = 0x3f3f3f3f3f3f3f3f;   const double pi = 3.1415926535898;   string s;   int q, n, sum1, sum2, sum3;   int main() {     ios::sync_with_stdio(false);     cin.tie(NULL);     ;     cin >> q;     while (q--) {       cin >> n;       sum1 = sum2 = sum3 = 0;       for (int i = 1; i <= n; ++i) {         cin >> s;         if (s.size() % 2) sum3++;         for (int j = 0; j < s.size(); ++j) {           if (s[j] ==  1 )             sum1++;           else             sum2++;         }       }       if (sum1 % 2 && sum2 % 2 && !sum3)         cout << n - 1 << endl;       else         cout << n << endl;     }     return 0;   }   