#include <bits/stdc++.h>
#define ll long long int
using namespace std;
void mainSolve()
{
int n;
cin >> n;
vector<int> cnt(2, 0);
for (int i = 0; i < n; i++)
{
int x;
cin >> x;
++cnt[x];
}
if (cnt[1] >= cnt[0])
cout << "1\n";
else
cout << "0\n";
}
int main()
{
#ifndef ONLINE_JUDGE
freopen("input.txt", "r", stdin);
freopen("output.txt", "w", stdout);
#endif
int t;
cin >> t;
while (t--)
{
mainSolve();
}
return 0;
}