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