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