(defn inner [X x]
  (->> (map #(Math/pow x %) (range 1 100))
    (take-while #(< % X))
    (apply max)
    int))


(defn Exponential [X]
  (->> (range 0 (Math/sqrt X))
    (map #(inner X %))
    (apply max)))

(-> (int (read))
  Exponential
  println)