a = int(input()) ans = a for i in range(2, 1000): j = 1 while pow(i, j) < a: j += 1 ans = min(ans, i*j) print(ans)