import java.util.*; import java.io.*; public class Main { public static void main(String[] args) throws Exception { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); long n = Long.parseLong(br.readLine()); TreeSet set = new TreeSet<>(); for (long i = 1; i <= Math.sqrt(n); i++) { if (n % i == 0) { set.add(i); set.add(n / i); } } long min = Long.MAX_VALUE; for (long x : set) { if (x > Math.sqrt(n)) { break; } for (long y : set) { if (y > Math.sqrt(n)) { break; } if (x * y > n) { break; } if (x > y) { continue; } if ((n / x) % y != 0) { continue; } min = Math.min(min, x + y + n / x / y - 3); } } System.out.println(min + " " + (n - 1)); } }