N=input();m,y,i=40**9,{},1 while i*i<=N: if N%i==0:y[i]=i i+=1 for a in y: for b in y: if N%(a*b)==0:m=min(m,a+b+N//(a*b)-3) print m,N-1