#include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #define REP(i,s,n) for(int i=(int)(s);i<(int)(n);i++) using namespace std; typedef long long int ll; typedef vector VI; typedef pair PI; const double EPS=1e-9; ll calc(ll n) { ll mi = n + 2; for (ll a = 1; a * a * a <= n; ++a) { if (n % a != 0) continue; for (ll b = a; b * b <= n / a; ++b) { if (n / a % b != 0) continue; mi = min(mi, a + b + n / a / b); } } return mi; } int main(void){ ll n; cin >> n; cout << calc(n) - 3 << " " << n - 1 << endl; }