import java.util.*; public class Main { public static void main (String[] args) { Scanner sc = new Scanner(System.in); long n = sc.nextLong(); long org = n; HashMap map = new HashMap<>(); for (long i = 2; i <= Math.sqrt(n); i++) { while (n % i == 0) { if (map.containsKey(i)) { map.put(i, map.get(i) + 1); } else { map.put(i, 1); } n /= i; } } if (n != 1) { if (map.containsKey(n)) { map.put(n, map.get(n) + 1); } else { map.put(n, 1); } } ArrayDeque deq = new ArrayDeque<>(); ArrayDeque next = new ArrayDeque<>(); deq.add(1L); for (long x : map.keySet()) { while (deq.size() > 0) { long y = deq.poll(); for (int i = 1; i <= map.get(x); i++) { next.add(y * (long)(Math.pow(x, i))); } next.add(y); } ArrayDeque tmp = deq; deq = next; next = tmp; } long min = Long.MAX_VALUE; ArrayList list = new ArrayList(deq); for (long x : list) { for (long y : list) { if ((org / x) % y == 0) { min = Math.min(min, x - 1 + y - 1 + org / x / y - 1); } } } System.out.println(min + " " + (org - 1)); } }