import math import sys f = lambda x: math.sqrt(2.0 * x + 0.25) - 0.5 g = lambda x: f(x) % 1 == 0 inp = map(int, sys.stdin.read().split()[1:]) print(" ".join("1" if g(x-1) else "0" for x in inp))