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