#include <iostream>

using namespace std;

int E;
int x,y,z;
long long solve(){
    long long ans = 1000000;
    for (z=0;z*z*z<=E;z++)
        for(y=0;y*y<=E-z*z*z;y++){
            x = E-z*z*z-y*y;
            if (x+y+z<ans) ans=x+y+z;
        }
    return ans;
}
int main() {
    while(cin>>E&&E>0) cout<<solve()<<endl;
}
