mod = 1000000007 eps = 10**-9 def main(): import sys input = sys.stdin.readline N = int(input()) ok = 1 ng = 10**18 mid = (ok+ng)//2 while ng - ok > 1: if mid * (mid+1) // 2 <= N: ok = mid else: ng = mid mid = (ok+ng)//2 if ok * (ok+1) // 2 == N: print("YES") print(ok) else: print("NO") if __name__ == '__main__': main()