#include using namespace std; typedef long long LL; int main(){ LL n; cin >> n; LL answer=n; for(LL a=46420;a>=1;--a){ if(n%a) continue; LL b; for(b=a;a*b*b<=n;++b); for(;b>=a;--b){ if(a+b+n/a/b-3>answer) break; if(n/a%b) continue; answer=min(answer,a+b+n/a/b-3); } } cout << answer << ' ' << n-1 << endl; return 0; }