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