#include #include #include using namespace std; typedef long long ll; int main() { ll n; cin >> n; //(a+1)(b+1)(c+1)=Nを満たす中でのa+b+cの最小値 ll ans = 1e9; for (ll a = ceil(cbrt(n)); a > 0; a--) { if (n%a != 0) continue; ll left = n / a; for (ll b = sqrt(left); b > 0; b--) { if (left%b != 0) continue; ll c = left / b; ans = min(a + b + c - 3, ans); } } cout << ans << " " << n - 1 << endl; return 0; }