#include int cas,n,m,l,t,p,ans; char a[1000],b[1000]; int main(){ scanf("%d",&cas); while (cas-->0){ scanf("%d",&n); if (n%2==0) ans=0; else ans=1; printf("%d\n",ans); } }