#include<iostream>
using namespace std;
int main()
{
long int t,n;
cin>>t;
while(t--)
{
cin>>n;
if(n%2==0)
cout<<"1"<<endl;
else
cout<<"0"<<endl;
}
return 0;
}
using namespace std;
int main()
{
long int t,n;
cin>>t;
while(t--)
{
cin>>n;
if(n%2==0)
cout<<"1"<<endl;
else
cout<<"0"<<endl;
}
return 0;
}