#include using namespace std; typedef unsigned long long ull; vector divisor(ull n) { vector res; for (ull i = 1; i * i <= n; i++) { if (n % i == 0) { res.emplace_back(i); res.emplace_back(n / i); } } sort(res.begin(), res.end()); return res; } int main() { cin.tie(0); ios::sync_with_stdio(false); ull n; cin >> n; ull tmax = n - 1; ull tmin = tmax; vector d = divisor(n); for (int i = 0; d[i] * d[i] * d[i] <= n; i++) { ull tmp = n / d[i]; for (int j = d.size() - 1; j >= 0; j--) { if (d[j] * d[j] > tmp || tmp % d[j]) continue; tmin = min(tmin, d[i] + d[j] + tmp / d[j] - 3); break; } } cout << tmin << " " << tmax << "\n"; return 0; }