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