N=int(input()) def judge(N): route=(1+8*N)**(1/2) if(route==int(route)): route_1=(route-1)/2 if(int(route_1)==route_1): print("YES") return int((route-1)/2) return "NO" print(judge(N))