#include #define int long long using namespace std; int n,t,len,l; int k; int i,ans; signed main(){ cin>>n; ans=t=n; while(t){ len++; t>>=1; } l=2; for(int j=log(n);j;j--){ l=(int)pow(n,1.0/j); for(int i=l;pow(i,j)<=n;i++){ ans=min(ans,n-(int)pow(i,j)+i+j); } //cout<