# -*- coding: utf-8 -*- """ No.648  お や す み  https://yukicoder.me/problems/no/648 """ import sys from sys import stdin input = stdin.readline def main(args): n = int(input()) lb = 1 ub = 2 * 10**18 found = -1 while lb +1 < ub: mid = (lb + ub) // 2 total = (1 + mid) * mid // 2 if total == n: found = mid break elif total > n: ub = mid else: lb = mid if found != -1: print('YES') print(found) else: print('NO') if __name__ == '__main__': main(sys.argv[1:])