N=int(input());m,y,i=10**14,[],1 while i*i<=N: if N%i==0:y.append(i) i+=1 for a in y: for b in y: if N%(a*b)==0:c=N//(a*b);m=min(m,a-1+b-1+c-1) print(m,N-1)