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