#include #define rep(i,n)for(int i=0;i<(n);i++) using namespace std; typedef long long ll; int main(){ ll n;cin>>n; ll l=1,r=3000000000; while(l!=r){ ll t=(l+r)/2; if(r-l==1)t=r; if(t*(t+1)/2<=n)l=t; else r=t-1; } if(l*(l+1)/2!=n)puts("NO"); else{ puts("YES"); printf("%lld\n",l); } }