from decimal import Decimal import math n = int(input()) f1 = Decimal(str((1+8*n))) ** Decimal(0.5) m1 = math.floor(f1) m2 = math.ceil(f1) if m1 == m2: print("YES") print((-1+m1)//2) else: print("NO")