#include<bits/stdc++.h>
using namespace std;
int main() {
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    vector<int> sq;
    vector<int> c;
    for (int i = 1; i*i < 500000; i++) {
        sq.push_back(i*i);
    }
    for (int i = 0; i < sq.size(); i++) {
        for (int j = 0; j < sq.size(); j++) {
            c.push_back(sq[i]+sq[j]);
        }
    }
    sort(c.begin(), c.end());
    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 j = 0;
    for (int i = 0; i < c.size(); i++) {
        if (c[i] == a[j].first) {
            otg[j] = 1;
            i--;
            j++;
            continue;
        }
        if (c[i] > a[j].first) {
            i--;
            j++;
            continue;
        }
    }
    for (int i = 0; i < n; i++) {
        cout << otg[i];
    }
    return 0;
}
