#include<bits/stdc++.h>
using namespace std;
vector<int>v(50000);
vector<int>b(500000);
bool run (int a,int n){
    for (int j=1;j*j<a;j++){
        if (b[a-j*j]==true){
            return true;
        }
    }
    return false;
}
int main (){
    int n,k,maxi;
    cin >> n;
    for (int i=0;i<n;i++){
        cin >> v[i];
        if (maxi<v[i]) maxi=v[i];
    }
    for (int i=0;i*i<maxi;i++){
        b[i*i]=true;
    }
    for (int i=0;i<n;i++){
        cout << run(v[i],n);
    }
    return 0;
}
