#include using namespace std; using i64 = int64_t; using vi = vector; using vvi = vector; int main() { long long n; cin >> n; long long mi = 1e18; for (long long i = 1; i * i * i <= n; i++) { if (n % i == 0) { long long a = n / i; for (long long j = 1; j * j <= a; j++) { if (a % j == 0) { mi = min(mi, (i - 1) + (j - 1) + (a / j - 1)); } } } } cout << mi << " " << n - 1 << endl; }