A = int(input())
res = 10**18
for i in range(1, 1000):
    for j in range(1, 100):
        if i**j > A:
            res = min(res, i * j)
print(res)