import java.util.Scanner

object Main {
  val sc = new Scanner(System.in)

  def main(args: Array[String]): Unit = {
    taskB
  }

  def taskA: Unit = {
    val a = sc.nextInt()
    val b = sc.nextInt()
    val c = sc.nextInt()
    val d = sc.nextInt()

    def abs(x: Int): Int = Math.abs(x)
    val ans = if ((abs(a - b) <= d && abs(b - c) <= d) || abs(a - c) <= d) {
      "Yes"
    } else {
      "No"
    }
    println(ans)
  }

  def taskB: Unit = {
    val x = sc.nextInt()

    def isPow(x: Int): Boolean = {
      if (x == 1) {
        true
      } else {
        for (i <- 2 to x) {
          var t: Int = x
          var cnt = 0
          while (t % i == 0) {
            cnt += 1
            t /= i
          }
          if (cnt >= 2) {
            return t == 1
          }
        }
        false
      }
    }

    val ans = Range(1, x + 1).reverse.filter(isPow).head
    println(ans)
  }
}