#include using namespace std; long n; bool ok(long k) { return k * (k + 1) >= 2 * n; } int main() { cin >> n; long lo = 0; long hi = 2000000000; while (hi - lo > 1) { long mid = (lo + hi) / 2; if (ok(mid)) { hi = mid; } else { lo = mid; } } if (hi * (hi + 1) == n * 2) { cout << "YES" << endl; cout << hi << endl; } else { cout << "NO" << endl; } }