#include using namespace std; int main() { long long a; cin >> a; vector answers(0); for (int n = 2; n < int(ceil(sqrt(float(a)))); ++n) { int m = int(ceil(log(float(a)) / log(float(n)))); answers.push_back(n*m); } cout << *min_element(answers.begin(), answers.end()) << endl; }