#include <bits/stdc++.h>
using namespace std;

typedef long long loong;

map<loong,int> e;
loong p[20];int pn;
loong ae[20];
loong n,m,a,t;

// 皆さんは自前のライブラリで素因数分解してください (^^)
void factor(loong n){
	char cmd[256];
	sprintf(cmd,"factor %lld",n);
	FILE* f=popen(cmd,"r");
	loong x;
	fscanf(f,"%lld:",&x);
	while(fscanf(f,"%lld",&x)==1){
		if(++e[x]==1){
			p[pn++]=x;
		}
	}
	fclose(f);
}

void find_b(loong b,int i){
	if(i==pn){
		loong c=m/b;
		if(t>a+b+c-3){
			t=a+b+c-3;
		}
	}else{
		for(int d=0;d<=e[p[i]]-ae[i]&&b*b<=m;++d,b*=p[i]){
			find_b(b,i+1);
		}
	}
}

void find_a(loong a,int i){
	if(i==pn){
		::a=a;
		m=n/a;
		find_b(1,0);
	}else{
		for(int d=0;d<=e[p[i]]&&a*a*a<=n;++d,a*=p[i]){
			ae[i]=d;
			find_a(a,i+1);
		}
	}
}

int main(){
	cin>>n;
	factor(n);
	t=n;
	find_a(1,0);
	cout<<t<<" "<<n-1<<endl;
	return 0;
}