from yogi import scan

n = scan(int)
while n is not None:
  print("1" if is_balanced(n) else "0")
  n = scan(int)

