n = int(input()) a = int((8*n+1)**0.5) for i in range(a-1,a+2): if i * i == 8 * n + 1: if i % 2 == 1: print("YES") print((i -1)//2) exit() print("NO")