#include #define rep(i,a,b) for(int i=a;i=b;i--) #define fore(i,a) for(auto &i:a) #define all(x) (x).begin(),(x).end() #pragma GCC optimize ("-O3") using namespace std; void _main(); int main() { cin.tie(0); ios::sync_with_stdio(false); _main(); } typedef long long ll; const int inf = INT_MAX / 2; const ll infl = 1LL << 60; templatebool chmax(T &a, const T &b) { if (abool chmin(T &a, const T &b) { if (b enumdiv(ll n) { vector S; for (ll i = 1; i*i <= n; i++) if (n%i == 0) { S.push_back(i); if (i*i != n) S.push_back(n / i); } sort(S.begin(), S.end()); return S; } /*---------------------------------------------------------------------------------------------------             ∧_∧       ∧_∧  (´<_` )  Welcome to My Coding Space!      ( ´_ゝ`) /  ⌒i     /   \    | |     /   / ̄ ̄ ̄ ̄/  |   __(__ニつ/  _/ .| .|____      \/____/ (u ⊃ ---------------------------------------------------------------------------------------------------*/ ll N; //--------------------------------------------------------------------------------------------------- void _main() { cin >> N; ll tmin = infl, tmax = -infl; auto dv = enumdiv(N); /*fore(a, dv) { ll rest = N / a; auto dv2 = enumdiv(rest); fore(b, dv2) { ll c = rest / b; chmin(tmin, a + b + c - 3); chmax(tmax, a + b + c - 3); } }*/ int n = dv.size(); rep(i, 0, n) rep(j, 0, n) { ll a = dv[i], b = dv[j]; if (!((inf < a) and (inf < b)) and N % (a * b) == 0) { ll c = N / a / b; chmin(tmin, a + b + c - 3); chmax(tmax, a + b + c - 3); } } printf("%lld %lld\n", tmin, tmax); }