import sys import math n = int(input()) drn = 1 + ((n - 1) % 9) triangular = math.sqrt(8 * n + 1) if triangular.is_integer() and (drn == 1 or drn == 3 or drn == 6 or drn == 9): print(f"YES\n{(int(triangular)-1)//2}") else: print("NO")