n=int(input())

MAX=10**18+8
MIN=0
MID=(MAX+MIN)//2

for i in range(10**5):
    if (MID*(MID+1)//2)==n:
        print("YES")
        print(MID)
        exit()
    elif (MID*(MID+1)//2)>n:
        MAX=MID
        MID=(MAX+MIN)//2
    elif (MID*(MID+1)//2)<n:
        MIN=MID
        MID=(MAX+MIN)//2
print("NO")