#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<pair<int, int>> a(n);
    vector<bool> otg(n, 0);
    for (int i = 0; i < n; i++) {
        cin >> a[i].first;
        a[i].second = i;
    }
    sort(a.begin(), a.end());
    int s = sq.size();
    for (int i = 0; i < s && sq[i] < a[n-1].first; i++) {
        for (int j = 0; j < s && sq[i] + sq[j] <= a[n-1].first; j++) {
            int sb = sq[i] + sq[j];
            for (int k = 0; k < n; k++) {
                if (a[k].first == sb) {
                    otg[a[k].second] = 1;
                }
                if (sb < a[k].first) {
                    break;
                }
            }
        }
    }
    for (int i = 0; i < n; i++) {
        cout << otg[i];
    }
    return 0;
}