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