#include using namespace std; #define FOR(i, n) for(int i = 0; i < (n); i++) #define FORR(x, arr) for(auto& x:arr) #define ITR(x, c) for(__typeof(c.begin()) x=c.begin();x!=c.end();x++) #define MEM(a, x) memset(a, x, sizeof(a)) #define ALL(a) a.begin(), a.end() #define UNIQUE(a) a.erase(unique(ALL(a)), a.end()) typedef long long ll; typedef pair P; ll n; int main(int argc, char const *argv[]) { ios_base::sync_with_stdio(false); cin >> n; ll mi=n-1, ma=n-1; if (n%2==0) { for (ll i = 1; i*i <= n; i++) { if (n%i==0) { for (ll j = 1; j*j <= n/i; j++) { if (n/i%j==0) mi = min(mi, i+j+n/i/j-3); } } } } cout << mi << " " << ma << endl; return 0; }