#include #include using namespace std; typedef long long ll; int main(void){ // Here your code ! ll N; ll mi = LLONG_MAX; ll bestc = -1; cin >> N; for(ll a=1;a*a*a<=N;a++){ if(N%a!=0){ continue; } ll M = N/a; ll startb = a; if(bestc != -1){ startb = M/bestc; } for(ll b=a;b*b<=M;b++){ if(M%b!=0){ continue; } ll c = M/b; ll total = (a-1)+(b-1)+(c-1); if(total < mi){ bestc = c; mi = total; } } } cout << mi << " " << N-1 << endl; return 0; }