#include using namespace std; long long n, m; int main() { cin >> n; m = n; for (int j = 2; j <= log2(n); j++) { long long i = (long long)pow(n, 1 / (double)j), u = pow(i, j); if (i + j + n - u < n) { m = min(m, i + j + n - u); } } cout << m << endl; }