#include #include #include #include #include #include #include #include #include #include #include #include #include #include #include using namespace std; #define REP(i,a,n) for(int i=(a); i<(int)(n); i++) #define rep(i,n) REP(i,0,n) #define FOR(it,c) for(__typeof((c).begin()) it=(c).begin(); it!=(c).end(); ++it) #define ALLOF(c) (c).begin(), (c).end() typedef long long ll; #define INF 1000000000LL vector divisor(ll n){ vector ret; for(ll i=1; i*i<=n; i++){ if(n%i==0){ ret.push_back(i); if(i!=n/i) ret.push_back(n/i); } } sort(ret.begin(), ret.end()); return ret; } int main(){ ios::sync_with_stdio(false); ll N; cin >> N; ll Tmin = INF, Tmax = 0; vector v = divisor(N); rep(i,v.size()){ ll d = v[i]-1; ll m = N/v[i]; vector w = divisor(m); rep(j,w.size()){ ll a = w[j]-1; ll b = (m/w[j])-1; Tmin = min(Tmin, a+b+d); Tmax = max(Tmax, a+b+d); } } cout << Tmin << " " << Tmax << endl; return 0; }