a=int(input()) ans=float('inf') for i in range(1,42): x=(a-1)**(1/i) x=int(x)+1 ans=min(ans, i*x) print(ans)