def main(): inp1 = int(input()) count = 0 sec = 1 sums = 0 loop_flg = True while loop_flg: if inp1 == sums: print("YES") print(count) break elif inp1 < sums: print("NO") break else: pass sums = sums + sec sec += 1 count += 1 if __name__ == '__main__': main()