#include <bits/stdc++.h>

#define ll long long int

using namespace std;

void solve(){

ll n,ans=1,t,c=0,d=0,e=0;

cin>>n;

for(int i=0; i<n; i++){

cin>>t;

if (t>1 || t<-1){c++;}

if(t==-1){d++;}

if(t==1){e++;}

if (c==2 || (d>0 && c>0)){ans=0; break;}

}

if(d>1 && e==0){ans=0;}

cout<<ans<<endl;

}

int main() {

ll t;

cin>>t;

while(t–){solve();}

return 0;

}