# include using namespace std; typedef long long ll; ll n, mn; int main() { scanf("%lld", &n); mn = n - 1; for (ll i = sqrt(n) + 1, x; i >= 1; i--) { if (n % i == 0) { x = n / i; for (ll j = sqrt(x) + 1; j >= 1; j--) { if (x % j == 0) mn = min(mn, i - 1 + j - 1 + x / j - 1); } } } printf("%lld %lld\n", mn, n - 1); return 0; }