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