def f(N): if N == 1: return 1 return N + f(N // 2) def possible(flag): if flag: print('YES');exit() N = int(input()) possible(N == 0) # bisect l, r = 0, 10 ** 9 while r - l > 1: m = (r + l) // 2 possible(f(m) == N) if f(m) > N: r = m else: l = m print('NO')