from math import sqrt import sys def f(n): return (n*(n+1))//2 N=int(input()) d=int((sqrt(8*N+1)-1)/2) for h in range(max(0,d-3),d+4): if f(h)==N: print("YES") print(h) sys.exit() print("NO")