#include #include #include #include int main() { long long n; std::cin >> n; long long max = n - 1, min = n - 1; long long a, b, c, end, end2; end2 = std::pow(n, 0.33333333333333) + 1; std::vector v; v.push_back(1); for (long long i = 1; i <= end2; ++i) { if (n % i == 0) v.push_back(i); } for (long long i = 0; i < v.size(); ++i) { long long tn = n / v[i]; end = sqrt(tn); for (long long j = v[i]; j <= end; ++j) { if (tn % j != 0) continue; min = std::min(min, v[i] + j + tn / j - 3); } } std::cout << min << " " << max << std::endl; return 0; }