import scala.io.{StdIn => in}

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

  val tableL = Array.ofDim[Int](n)
  val tableR = Array.ofDim[Int](n)

  var f = a.head
  var l = a.last
  for(i <- 0 until n-1) {
    val j = n-1 - i
    f = gcd(f, a(i))
    tableL(i+1) = f
    l = gcd(l, a(j))
    tableR(j-1) = l
  }

  val init = tableR(0) max tableL(n-1)
  val ans = (1 until n-1)./:(init)((acc,i) => acc max gcd(tableL(i),tableR(i)))
  println(ans)

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