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