N=int(input()) ans=N for i in range(100): if i==0: continue x=pow(N,1/i) x=int(x) #print(x**i) if(x**i>N): ans=min(ans,x*i) for j in range(1000): x+=1 if(x**i>N): ans=min(ans,x*i) if N==int(1e18): x=1/0 print(ans)