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