N = int(input()) def f(x): return x * (x + 1) // 2 ng, ok = 0, 100000 while abs(ok - ng) > 1: mid = (ok + ng) // 2 if f(mid) >= N: ok = mid else: ng = mid if f(ok) == N: print("YES") print(ok) else: print("NO")