A = int(input()) for k in range(3, 10000000): if (A - k * (k - 1) // 2) % k == 0: print("YES") exit() print("NO")