#include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include using namespace std; typedef long long ll; typedef pair pii; typedef pair pll; typedef vector vi; typedef vector vl; typedef vector> vvl; #define REP(var, a, b) for (int var = (a); var < (b); var++) #define rep(var, n) for (int var = 0; var < (n); ++var) #define ALL(c) (c).begin(), (c).end() #define rALL(c) (c).rbegin(), (c).rend() ll MOD = 1000000007; ll INF = 1e18; int main() { // ll n; cin >> n; ll m = sqrt(2 * n) + 1; while (m * (m+1) / 2 > n) { m--; } if (m * (m + 1) / 2 == n) { cout << "YES" << endl; cout << m << endl; } else { cout << "NO" << endl; } return 0; }