#include<bits/stdc++.h>
using namespace std;
long long n,a[1000005],sum=1,x,j;
bool check(int x){
int l=1-1,r=j+1;
while(l+1<r){
int mid=(l+r)/2;
if(x==a[mid]) {
return 1;
}
else if(x<a[mid]) r=mid;
else l=mid;
}
return 0;
}
int main(){
ios::sync_with_stdio(false);
cin.tie(0);cout.tie(0);
cin>>n;
while(1){
j++;
sum+=j;
a[j]=sum;
if(a[j]>=1e9){break;}
}
for(int i=1;i<=n;i++){
cin>>x;
if(check(x)) cout<<1<<endl;
else cout<<0<<endl;
}
}