#include<iostream>
using namespace std;
int main()
{
int n;
cin >>n;
int a[n+5] = {};
int r;
for(int i = 1;i <= n;i++)
{
r = 0;
cin >>a[i];
int q =a[i];
for(int j = 2;j <= a[i];j++)
{
for(int z = 2;z <=q;z++)
{
if(q %j == 0)
{
if(j % z!=0 || j == z)
{
r++;
}
else
{
z =q;
}
}
}
}
if(r%2==0)
{
cout <<1<<endl;
}
else{
cout <<0<<endl;
}
}
}
}