import math A=int(input()) result=float('inf') for i in range(2,100): result=min(result,i*math.ceil(math.log(A,i))) print(result)