#include <iostream>
#include <cstring>

using namespace std;

int main () {
   int n;

   cin >> n;

   int arr[n];

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



   for (int i = 0; i < n; i ++) {
        for (int j = 1; j < n; j ++) {
        for (int b = 1; b < n; b ++)
        {

            if (arr[i] == b * b + j * j) {
                arr[i] = 1;
        }

        if (arr[i] != (b*b + j * j)) {
            arr[i] = 0;
        }
   }
   }
   }

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



   return 0;
}