n = int(input()) sqrt = (1+8*n)**0.5 if sqrt.is_integer(): print("YES") print(int((-1+sqrt))//2) else: print("NO")