import scala.io.StdIn._

object Main extends App {

  val n = readInt()
  val A = readLine().split(" ").map(_.toInt)

  def solve() = {
    val l = Array.fill(n)(0)
    val r = Array.fill(n)(0)
    
    for(i <- 0 until n-1) l(i+1) = gcd(l(i), A(i))
    for(i <- n-1 until 0 by-1) r(i-1) = gcd(r(i), A(i))
    
    (0 until n).foldLeft(1) { (acc, i) =>
      Math.max(acc, gcd(l(i), r(i)))
    }
  }

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

  println(solve())

}

