#include <stdio.h>

int main()
{
    int n,m;
    int i;
    int count=0,sum=0;
    scanf("%d",&n);
    for(i=0;i<n;i++)
    {
        count=0;
        sum=0;
        scanf("%d",&m);
        while(m>0)
        {
            if(m&1)
                count++;
            else
                sum++;
            m=m>>1;   
        }
        if(count%2==0&&sum%2!=0)
        printf("1 ");
        else if(count%2!=0&&sum%2==0)
        printf("0 ");
        else if(count%2!=0&&sum%2!=0)
        printf("100 ");
        else
        printf("10 ");
    }
    return 0;
}