import scala.io.StdIn

object Main {
  def main(args: Array[String]): Unit = {
    val n = StdIn.readLine.toInt
    val as = StdIn.readLine.split(" ").map(_.toInt)

    //(0 +: as :+ 0).foreach {println}  // 別にこれいらないか

    val l = Array.fill(n + 2)(0)
    val r = Array.fill(n + 2)(0)

    for (i <- 1 to n) {
      l(i) = gcd(l(i - 1), as(i - 1))
    }

    for (i <- n to 1 by -1) {
      r(i) = gcd(r(i + 1), as(i - 1))
    }

    println((1 to n).toList.map(i => gcd(l(i - 1), r(i + 1))).max)
  }

  def gcd(a: Int, b: Int): Int = if (b == 0) a else gcd(b, a % b)
}