import sys import math from decimal import * getcontext().prec = 40 n = int(input()) drn = 1 + ((n - 1) % 9) if drn == 1 or drn == 3 or drn == 6 or drn == 9: triangular = Decimal(8 * n + 1).sqrt() if triangular.quantize(Decimal("0"), rounding=ROUND_UP) == triangular.quantize( Decimal("0"), rounding=ROUND_DOWN ): print(f"YES\n{(int(triangular)-1)//2}") sys.exit() print("NO")