#include #include #include #include #include #include #include #include #include #include using namespace std; typedef long long ll; int main() { ll N; cin >> N; vector nums; for (ll i = 1; i * i <= N; ++i) { if (N % i == 0) { nums.push_back(i); } } ll min_T = LLONG_MAX; ll max_T = N - 1; for (ll a : nums) { for (ll b :nums) { if (N % (a * b) != 0) continue; ll c = N / (a * b); ll t = (a + b + c) - 3; min_T = min(min_T, t); } } cout << min_T << " " << max_T << endl; return 0; }