N = int(input()) M = int((2 * N)**0.5 - 0.1) + 1 if M * (M + 1) == 2 * N: print('YES') print(M) elif M * (M - 1) == 2 * N: print('YES') print(M - 1) else: print('NO')