#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];
   }

   for (int i = 0; i < n; i ++) {
    for (int j = 0; j < n; j ++) {
        arrA[i] = (i + 1) * (i + 1);
        arrB[j] = (j + 1) * (j + 1);
    }
   }

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

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




   return 0;
}
