#include using namespace std; int main(){ long long n;cin>>n; long long ans = n-1; for(long long i = 2; n >= i*i; i++){ if(n%i == 0){ ans = min(ans, (i-1)+(n/i-1)); 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; }