def BinarySearch(yes, no, A, n): while abs(yes - no) != 1: mid = (yes + no)//2 if A >= n * mid + n * (n - 1) // 2: yes = mid else: no = mid return n * yes + n * (n - 1) // 2 A = int(input()) n = 3 while n * (n - 1) // 2 <= A: B = BinarySearch(-2, 10 ** 9 + 5, A, n) if A == B: print("YES") exit() n += 1 print("NO")