#include <bits/stdc++.h>   using namespace std;   int main() {     long long t1, n, zero, one, cnt, cnt1, i, j;     string s;     cin >> t1;     while (t1--) {       cin >> n;       cnt = 0, zero = 0, one = 0;       for (i = 0; i < n; i++) {         cin >> s;         for (j = 0; j < s.length(); j++) {           if (s[j] ==  0 )             zero++;           else             one++;         }         if (s.length() % 2 != 0) cnt++;       }       cnt1 = 0;       if (zero % 2 != 0) cnt1++;       if (one % 2 != 0) cnt1++;       if (cnt >= cnt1)         cout << n << endl;       else         cout << n - 1 << endl;     }   }   