open System

let sqrtLong (n: int64) : int64 =
    if n = 0L || n = 1L then n
    else
        let mutable x0 = n / 2L
        let mutable x1 = (x0 + n / x0) / 2L
        while x1 < x0 do
            x0 <- x1
            x1 <- (x0 + n / x0) / 2L
        x0

[<EntryPoint>]
let yuki648 argv : int =
    let n = 2L * Int64.Parse(Console.ReadLine())
    let k = sqrtLong n
    if n = k * (k + 1L) then
        printfn "YES"
        printfn "%i\n" k
    else
        printfn "NO"
    0