A = int(input()) ans = 10**18 for i in range(2, 130): temp, cnt = 1, 0 while temp < A: temp *= i cnt += 1 ans = min(ans, i * cnt) print(ans)