n = int(input()) l, r = 0, 10 ** 18 while r - l > 1: m = (l + r) // 2 if m * (m + 1) // 2 >= n: r = m else: l = m if r * (r + 1) // 2 == n: print("YES") print(r) else: print("NO")