#include<bits/stdc++.h>
using namespace std;
int main() {
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    vector<int> sq;
    for (int i = 1; i*i < 500000; i++) {
        sq.push_back(i*i);
    }
    int n;
    cin >> n;
    vector<int> a(n);
    for (int i = 0; i < n; i++) {
        cin >> a[i];
        bool b = 0;
        for (int j = 0; j < sq.size(); j++) {
            for (int k = 0; k < sq.size(); k++) {
                if (sq[j] + sq[k] == a[i]) {
                    b = 1;
                    break;
                }
            }
            if (b == 1) {
                break;
            }
        }
        cout << b;
    }
    return 0;
}
