#include #include #include using namespace std; void solve() { int n; cin >> n; vector v(n); for(auto& x: v) cin >> x; if(n%2==0) { bool even = false; for(int out: v) if(out % 2 == 0) even = true; if(even) cout << "1\n"; else cout << "0\n"; } else { for(auto& x: v) x = __builtin_ctzll(x); sort(v.begin(), v.end()); if(v[0] == v.back()) cout << "0\n"; else cout << "1\n"; } } int main() { int t; cin >> t; while(t--) solve(); }