a = int(input()) res = 1 n = 3 while res + n - 1 < a: res += n - 1 if (a - res) % n == 0: print("YES") exit() n += 1 print("NO")