import java.util.*; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); long n = sc.nextLong() * 2; long left = 0; long right = (long)(Math.sqrt(Long.MAX_VALUE)) - 1; while (right - left > 1) { long m = (left + right) / 2; if (m * (m + 1) <= n) { left = m; } else { right = m; } } if (left * (left + 1) == n) { System.out.println("YES"); System.out.println(left); } else { System.out.println("NO"); } } }