object Main extends App{
import scala.math._

val x = scala.io.StdIn.readInt()

var max_b:Double = 0
for (i<-1 to sqrt(x).toInt) {
  val b = pow(i,(log(x)/log(i)).toInt)
  max_b = max(max_b, b)
}
println(max_b.toInt)
}