import java.util.*; public class Main { static final long MAX = (long)Math.sqrt(Long.MAX_VALUE); public static void main (String[] args) { Scanner sc = new Scanner(System.in); long n = sc.nextLong() * 2; long left = 0; long right = MAX; 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"); } } }