let rec sqrt n guess = let curGuess = match guess with | None -> n / 2m | Some(x) -> x let res = n / curGuess let ave = (curGuess + res) / 2m if ave = curGuess then ave else sqrt n (Some(ave)) let isInt (n:decimal) = let str = n.ToString().Split('.') str.Length > 1 && str.[1].ToCharArray() |> Array.forall(fun x -> x ='0') let isValid n = let f n = ((sqrt (8m * n + 1m) None )-1m)/2m f n |> isInt let n = stdin.ReadLine() |> decimal n |> isValid |> function | true -> "YES" | _ -> "NO" |> printfn "%s"