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