#include using ll = long long; using namespace std; const int INFint = 1e9+1; const ll INFll = (ll)1e18+1; ll MOD=1e9+7; int main(){ ll A; cin>>A; int ans(1e9); for(int i(2);i<100;i++){ ll tmp(1); int cnt(0); while(tmp < A){ tmp *= i; cnt++; } ans = min(ans,i*cnt); } cout << ans << endl; return 0; }