n=int(input()) t=n i=1 while i*i*i<=n: if n%i==0: m=n//i; j=1 while j*j<=m: if m%j==0: t=min(t,i+j+m//j-3) j+=1 i+=1 print(t,n-1)