n = int(input()) res = 0 left = 1 right = 2 * 10**10 while right - left >= 0: c = (left + right) // 2 d = c * (c + 1) // 2 if d == n: res = c break elif d < n: left = c + 1 elif n < d: right = c if left == right == c: break if res >= 1: print('YES') print(res) else: print('NO')