let () = Scanf.scanf "%d\n" @@ fun x ->
  Array.init (int_of_float (sqrt @@ float_of_int x) - 1) (( + ) 2)
  |> Array.map (fun b ->
    int_of_float @@ ceil@@ float_of_int b ** ceil (log (float_of_int x) /. log (float_of_int b) -. 1.))
  |> Array.fold_left max min_int
  |> Printf.printf "%d\n"