n=int(input()) OK=10**18 NG=0 while OK>NG+1: mid=(OK+NG)//2 if mid*(mid+1)//2>=n: OK=mid else: NG=mid if OK*(OK+1)//2: print("YES") print(OK) else: print("NO")