import math n = int(input()) a = round(math.sqrt(n*8+1)) if a**2 == n*8+1: print 'YES' print int((a-1)/2) else : print 'NO'