import math N = int(input()) s = sum(int(c) for c in str(N)) d = 1 + 8 * s sqrt_d = math.isqrt(d) if sqrt_d * sqrt_d == d: print(1) else: print(0)