#include #include #include #include #include #include #include #include #include #include #include #include #include #include #include using namespace std; int main() { long long n; cin >> n; long long ok = 1000000007, ng = 0; while (ok - ng > 1) { long long mid = (ok + ng) / 2; if (mid * (mid + 1) / 2 >= n) { ok = mid; } else { ng = mid; } } if (ok * (ok + 1) / 2 == n) { cout << "YES" << endl; cout << ok << endl; } else { cout << "NO" << endl; } }