#include <bits/stdc++.h>   using namespace std;   int thien, n, tt, h;   string s;   int main() {     cin >> tt;     for (int ii = 1; ii <= tt; ii++) {       cin >> n;       thien = 0;       h = 0;       for (int i = 1; i <= n; i++) {         cin >> s;         if (s.length() % 2 != 0) thien++;         for (int j = 0; j < s.length(); j++)           if (s[j] ==  1 ) h++;       }       if (h % 2 != 0 && thien == 0)         cout << n - 1 << endl;       else         cout << n << endl;     }   }   