n=int(input()) ok=0 ng=10**18 while ng-ok>1: mid=(ok+ng)//2 if mid**2<=n:ok=mid else:ng=mid i=ok j=2 k=n-i**j print(i+j+k)