def f(x): return x*(x+1)//2 n=int(input()) ng=0 ok=2*10**18 cnt=0 while ok-ng>1: mid=(ok+ng)//2 if f(mid)>=n: ok=mid else: ng=mid if f(mid)==n: print("YES") print(ok) else: print("NO")