import scala.io.StdIn


object Main extends App {
  val n  = StdIn.readLine().toInt
  val a  = StdIn.readLine().split(" ").map(_.toInt)

  def solve(a: Array[Int]): Int = {

    if (a.length == 2) {
      a.max
    } else {
      val c = for (x <- 1 to (a.max / 2)
        if a.filter(_ % x == 0).length <= 1) yield {
        x
      }
      c.max
    }

  }

  def gcd(x: Int, y: Int) :Int = {
    if (y == 0 ) x
    else gcd(y, (x % y))
  }

  println(solve(a))

}
  


