#include using namespace std; #include using namespace atcoder; using ll=long long; using Graph=vector>>; #define MAX 100000 #define MOD 1000000007 #define INF 1000000000000000000 int main(){ ll n; cin>>n; ll ans=n+1; for(ll i=2;i<=1000000;i++){ ll x=1; int j=0; while(x<=n/i){ x*=i; j++; ans=min(ans,i+(ll)j+n-x); } } ll left=0; ll right=1000000001; while(left+1(ans,left+2+n-left*left); cout<