#include <iostream>
#include <cstring>

using namespace std;

int main () {
   int n;

   cin >> n;

   int arr[n];

   int arrA[n];
   int arrB[n];

   for (int i = 0; i < n; i ++) {
        cin >> arr[i];
   }

   int result[n];

   for (int i = 0; i < n; i ++) {
        for (int j = 1; j < n; j ++) {
            for (int k = n - (j * j); k < n; k ++) {
                if (arr[i] == j * j + k * k) {
                    arr[i] = 1;
                }else {
                    arr[i] = 0;
                }

                result[i] = arr[i];
            }
        }
   }

   for (int i = 0; i < n; i ++) {
    cout << result[i];
   }
   return 0;
}


