#define _USE_MATH_DEFINES #include using namespace std; #define int long long int dx[] = {1, 0, -1, 0, 1, -1, -1, 1}; int dy[] = {0, 1, 0, -1, 1, 1, -1, -1}; int n; signed main() { cin >> n; int lb = -1, ub = n; while (ub - lb > 1) { int mid = (lb + ub) / 2; if (mid * (mid + 1) >= 2 * n) { ub = mid; } else { lb = mid; } } if (ub * (ub + 1) == 2 * n) { cout << "YES" << endl << ub << endl; } else { cout << "NO" << endl; } return 0; }