n = int(input()) x = int((2 * n) ** 0.5) while x * (x + 1) // 2 < n: x += 1 if x * (x + 1) // 2 == n: print("YES") print(x) else: print("NO")