#include #define MIN(a,b) ((a)<(b)?(a):(b)) typedef long long int ln; ln calc2(ln n,ln s){ ln res=n-1; ln k=s; while(k*k<=n){ if(n%k==0){ res=MIN(res,k+n/k-2); } k++; } return res; } ln calc3(ln n){ ln res=n-1; ln k=2; while(k*k<=n){ if(n%k==0){ res=MIN(res,k-1+calc2(n/k,k)); } k++; } return res; } void run(void){ ln n; scanf("%lld",&n); ln max=n-1; ln min=calc3(n); printf("%lld %lld\n",min,max); return; } int main(void){ run(); return 0; }