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