#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 = N-1, Tmax = N-1; vector v = divisor(N); rep(i,v.size()){ ll d = v[i]-1; REP(j,i,v.size()){ ll a = v[j] - 1; if(v[i] * v[j] > N) break; ll b = N/v[i]/v[j] - 1; Tmin = min(Tmin, a+b+d); } } cout << Tmin << " " << Tmax << endl; return 0; }