#include using namespace std; int n,test; int main() { scanf("%d",&test); while (test--) { scanf("%d",&n); if ((n&1)==0) printf("0\n"); else printf("1\n"); } }