from math import log, ceil a=int(input()) ans=float("inf") for i in range(2,1000): ans=min(ans,i*ceil(log(a,i))) print(ans)