#include using namespace std; typedef long long ll; typedef pair P; #define p_ary(ary,a,b) do { cout << "["; for (int count = (a);count < (b);++count) cout << ary[count] << ((b)-1 == count ? "" : ", "); cout << "]\n"; } while(0) #define p_map(map,it) do {cout << "{";for (auto (it) = map.begin();;++(it)) {if ((it) == map.end()) {cout << "}\n";break;}else cout << "" << (it)->first << "=>" << (it)->second << ", ";}}while(0) templateostream& operator<<(ostream& os,const pair& a) {os << "(" << a.first << ", " << a.second << ")";return os;} const char newl = '\n'; int main() { ll a; cin >> a; ll ans = 1e18; for (ll i = 2;;++i) { ll d = 1; int cnt = 0; while (d < a) { cnt++; if (d > a/i) break; d *= i; } ans = min(ans,cnt*i); if (i*i >= a) break; } cout << ans << endl; }