#include #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 = 1; b * b <= N / a; ++b) { if (N % b != 0) continue; minV = min(minV, a + b + N / a / b - 3); } } cout << minV << ' ' << N - 1 << endl; } int main() { read(); work(); return 0; }