#include <iostream>
#include <cstdio>
using namespace std;
int main()
{
freopen ("unlessseq.in","r",stdin);
freopen ("unlessseq.out","w",stdout);
long long n,nn;
cin>>n;
long long num[n+1];
cin>>num[1];
nn=num[1];
for(long long i=2;i<=n;i++)
{
cin>>num[i];
if(num[i]>nn)
nn=num[i];
}
long long nnn[nn+1],a=1;
nnn[1]=1;
for(int i=2;i<=nn;i++)
{
long long j;
nnn[i]=1;
for(j=i+1;j<=a+i;j++)
nnn[j]=0;
i=j-1;
a++;
}
for(long long i=1;i<=n;i++)
cout<<nnn[num[i]]<<endl;
return 0;
}