#include <iostream>
using namespace std;
bool pan[1000000001]={0};
int main()
{
    int n,now=1;
    for(int i=0;now<=1000000000;i++){
        now+=i;
        pan[now]=1;
    }
    cin>>n;
    for(int i=1;i<=n;i++){
        int u;
        cin>>u;
        cout<<pan[u]<<endl;
    }
}
