using System; public class Hello { public static void Main() { var n = long.Parse(Console.ReadLine().Trim()); var res = search(n); if (res * (res + 1)/2L == n) { Console.WriteLine("YES"); Console.WriteLine(res); } else Console.WriteLine("NO"); } public static long search (long n) { var ng = 1L; var ok = (long)Math.Sqrt(2 * n) + 1; while (ok - ng > 1) { var mid = ng + (ok - ng) / 2L; if (calc(mid, n)) ok = mid; else ng = mid; } return ok; } public static bool calc (long a , long n) => a * (a + 1) / 2 >= n; }