#include #include using namespace std; int main(){ long long n;cin>>n; long long a = n; for(long long i = 1; n >= i*i; i++){ if(!(n%i)){ //i for(long long j = 1; n/i >= j*j; j++){ if(!(i%j)){ //cout << i << " " << j << " " << n/(i*j) << endl; a = min({a,i+j+n/(i*j)-3}); } } //n%i for(long long j = 1; i >= j*j; j++){ if(!((n/i)%j)){ //cout << (n/i) << " " << j << " " << n/((n/i)*j) << endl; a = min({a,(n/i)+j+n/((n/i)*j)-3}); } } } } cout << a << " " << n-1 << endl; }