# include using namespace std; typedef long long ll; # define int long long # define lc u << 1 # define rc u << 1 | 1 # define fi first # define se second int n; signed main () { // freopen ("square.in", "r", stdin); freopen ("square.out", "w", stdout); scanf ("%lld", &n); int ans = n - 1; for (int i = 2; i * i <= n; i ++ ) { if (n % i == 0) { ans = min (ans, (i - 1) + (n / i - 1)); int m = n / i; for (int j = i; j * j <= m; j ++ ) { if (m % j == 0) ans = min (ans, (i - 1) + (j - 1) + (m / j - 1)); } } } printf ("%lld %lld\n", ans, n - 1); return 0; }