using System; using System.Collections.Generic; using System.Linq; class Program { static string ReadLine() { return Console.ReadLine(); } static int ReadInt() { return int.Parse(ReadLine()); } static int[] ReadInts() { return ReadLine().Split().Select(int.Parse).ToArray(); } static string[] ReadStrings() { return ReadLine().Split(); } static int Calc(int n) { // n = a * b * c // a + b + c - 3 の最小値を求める int ans = int.MaxValue; for (int i = 1; i * i * i <= n; i++) { if (n % i == 0) { int x = n / i; for (int j = i; j <= x; j++) { if (x % j == 0) { int y = x / j; ans = Math.Min(ans, i + j + y - 3); } } } } return ans; } static void Main() { int n = ReadInt(); int ans = Calc(n); Console.WriteLine("{0} {1}", ans, n-1); } }