#coding: utf-8 #yuki376 import math n=int(raw_input()) temp=n i=1 while i**3<=n: if n%i==0: m=n/i j=1 while j*j<=m: if m%j==0: k=m/j if temp>i+j+k-3: temp=i+j+k-3 j+=1 i+=1 print temp,n-1