#include <bits/stdc++.h>
using namespace std;
int main()
{
ios::sync_with_stdio(false);
cin.tie(nullptr);
cout.tie(nullptr);
int test = 1;
cin >> test;
while (test--)
{
int n;
cin >> n;
int even = 0, odd = 0;
for (int i=0; i<n; ++i) {
int in ;
cin >> in;
if (in % 2 == 1) odd++;
else even++;
}
if (odd % 2 == 1)
{
cout << even << "\n";
continue;
}
cout << min(even, odd / 2) << "\n";
}
return 0;
}