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 = 1; 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++){ if (y[i] <= (int)(Math.cbrt(n))){ a = y[i]; for (int j = i; j < tail; j++){ b = y[j]; if (n%(a*b) == 0 && b <= (int)(Math.sqrt(n/a))){ 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 (n%(a*b) == 0 && b <= (int)(Math.sqrt(n/a))){ 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)); } }