#include using namespace std; #define int long long signed main() { std::ios_base::sync_with_stdio(false); std::cin.tie(nullptr); int n; cin >> n; int l = 0, r = 3001001001; while (l + 1 < r) { int m = (l + r) / 2; if (m * (m + 1) / 2 <= n) l = m; else r = m; } if (l * (l + 1) / 2 == n) { cout << "YES" << endl; cout << l << endl; } else { cout << "NO" << endl; } }