# -*- coding: utf-8 -*- if __name__ == "__main__": n = int(input()) N = 2*(10**18) sum_sheep = 0 for i in range(1,N): sum_sheep += i if sum_sheep < n: continue elif sum_sheep == n: print("YES") print(i) exit() else: print("NO") exit()