// No.648  お や す み  // https://yukicoder.me/problems/no/648 // #include #include #include using namespace std; int main() { std::cin.tie(nullptr); std::ios::sync_with_stdio(false); long long n; cin >> n; long long lb = 0; long long ub = 2 * pow(10, 10); long long found = -1; while (lb + 1 < ub) { long long mid = (lb + ub) / 2; long long total = (1 + mid) * mid / 2; if (total == n) { found = mid; break; } else if (total > n) ub = mid; else lb = mid; } if (found != -1) cout << "YES" << endl << found << endl; else cout << "NO" << endl; }