object Main {

  private def gcd(a: Int, b: Int): Int = {
    val r = a % b
    if (r == 0) b
    else gcd(b, r)
  }

  private def max(a: Int, b: Int): Int =
    if (a > b) a else b

  def main(args: Array[String]): Unit = {
    val n = scala.io.StdIn.readLine().toInt
    val a = scala.io.StdIn.readLine().split(" ").map(_.toInt)
    val m = Array.fill(n, n)(Int.MinValue)

    for {
      i <- 0 until n
      j <- 0 until n
      if i == j
    } m(i)(i) = a(i)

    (0 until n - 1).foreach { i =>
      ((i + 1) until n).foreach { j =>
        if (m(i)(j-1) > a(j))
          m(i)(j) = gcd(m(i)(j-1), a(j))
        else
          m(i)(j) = gcd(a(j), m(i)(j-1))
      }
    }

    val res = (0 until n).map { i =>
      if (i == 0) {
        m(1)(n-1)
      } else if (i == n - 1) {
        m(0)(n-2)
      } else {
        gcd(m(0)(i-1), m(i+1)(n-1))
      }
    }.max

    println(max(gcd(m(0)(n-2), a(n-1)), res))
  }

}