#include const int MOD = 1e9 + 7; const int iINF = 1000000000; const long long int llINF = 1000000000000000000; const double PI = acos(-1.0); #define rep(i, n) for (int i = 0; i < (n); i++) using namespace std; using ll = long long int; using P = pair; using edge = struct { int to; int cost; }; int dx[4] = {1, 0, -1, 0}; int dy[4] = {0, 1, 0, -1}; ll N; bool check(ll t) { return N <= t * (t + 1) / 2; } int main() { cin >> N; ll ng = 0, ok = 1e9; while(ok - ng > 1) { ll mid = (ng + ok) / 2; (check(mid) ? ok : ng) = mid; } if(ok == 1e9) cout << "NO" << endl; else cout << "YES\n" << ok << endl; return 0; }