def sleep(n):
    i = 0
    j = n
    while i < j - 1:
        m = (i + j) // 2
        if m * (m + 1) // 2 >= n:
            j = m
        else:
            i = m
    if j * (j + 1) // 2 == n:
        print("YES")
        print(j)
    else:
        print("NO")


n = int(input())
sleep(n)