from collections import * from functools import * from itertools import * from heapq import * import sys,math input = sys.stdin.readline n = int(input()) def is_ok(x): return x*(x+1)//2 >= n y = 10**10 x = 0 while y-x>1: mid = (y+x)//2 if is_ok(mid): y = mid else: x = mid if y*(y+1)//2==n: print('YES') print(y) else: print('NO')