#include #include #include #include #define rep(i,a,b) for(int i=(a);i<(b);i++) #define pb push_back #define mp(a,b) make_pair(a,b) #define all(a) a.begin(),a.end() #define pii pair #define ll long long using namespace std; #define MAX 1000000000000 #define LMAX 10000000 ll N; vector V; void divisor(void) { rep(i,2,LMAX) { if(N%i == 0) V.pb(i); } } int main(void) { cin >> N; ll max = N-1; ll min = N-1; divisor(); // for(auto i:V) cout << i << " "; cout << endl; rep(i,0,V.size()){ ll ti = N / V[i]; rep(j,0,V.size()) { if(ti % V[j]) continue; ll tj = ti / V[j]; // printf("V[i]=%lld V[j]=%lld tj=%lld\n",V[i],V[j],tj); min = std::min(min, V[i]+V[j]+tj-3); } } cout << min << " " << max << endl; return 0; }