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