import math n = int(input()) s, t = 1, int(2e9) def f(x): return x * (x + 1) /2 while(s + 1 != t): x = (s + t) // 2 f_x = f(x) if f_x == n: print("YES") print(x) elif f_x > n: t = x + 1 else: s = x -1 print("NO")