#include using namespace std; typedef long long ll; const int MOD = 1000000007; const ll INF = 2000000000; #define REP(i,n) for((i)=0;(i)<(int)(n);(i)++) ll n; ll func(ll x){ return x * (x + 1) / 2; } bool C(ll k){ return func(k) >= n; } int main(){ cin >> n; ll ng = 0; ll ok = INF; while(abs(ok - ng) > 1){ ll mid = (ok + ng) / 2; if (C(mid)) ok = mid; else ng = mid; } if (func(ok) == n) cout << "YES\n" << ok << endl; else cout << "NO" << endl; return 0; }