import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); double n = sc.nextDouble(); int l = (int)Math.floor(Math.sqrt(n)); int []y = new int [l]; int tail = 0; for (int i = 0; i <= l; i++){ if (n%i == 0) y[tail++] = i; } int []x = new int [tail]; for (int i = 0; i < tail; i++){ x[i] = (int)(n/y[i]); } int m = -1; int a,b; for (int i = 0; i < tail; i++){ a = y[i]; if (a*a*a <=n){ for (int j = 0; j < tail; j++){ b = y[i]; if (b >= a && n%(a*b) == 0 && a*b*b <= n){ if (m == -1){ m = a+b+(int)(n/(a*b))-3; } else{ m = Math.min(a+b+(int)(n/(a*b))-3, m); } } b = x[i]; if (b >= a && n%(a*b) == 0 && a*b*b <= n){ if (m == -1){ m = a+b+(int)(n/(a*b))-3; } else{ m = Math.min(a+b+(int)(n/(a*b))-3, m); } } } } } System.out.println(m+" "+(int)(n-1)); } }