#include #include using namespace std; long long N; void read() { cin >> N; } void work() { long long minV = N - 1; for (long long a = 1; a * a * a <= N; ++a) { if (N % a != 0) continue; for (long long b = a, t = N / a; b * b <= t; ++b) { if (t % b != 0) continue; minV = min(minV, a + b + t / b - 3); } } cout << minV << ' ' << N - 1 << endl; } int main() { read(); work(); return 0; }