#include using namespace std; #ifdef LOCAL #include "settings/debug.cpp" #define _GLIBCXX_DEBUG #else #define Debug(...) void(0) #endif #define rep(i, n) for (int i = 0; i < (n); ++i) using ll = long long; using ull = unsigned long long; inline int ceillog(ll x, int base) { int ans = 0; while (x > 0) { x /= base; ans++; } return ans; } int main() { ll a; cin >> a; ll ans = a; for (ll b = 2; b <= ans; b++) { int p = ceillog(a, b); Debug(a, b, p, b * p, ans); ans = min(ans, (ll) b * p); } cout << ans << endl; return 0; }