a = int(input()) ans = a n = 2 while True: m = 1 while n**m < a: m += 1 if ans < n*m: break ans = n*m n += 1 print(ans)