import scala.io.{StdIn => in}
import scala.collection.{mutable => mu}
import scala.annotation.tailrec

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)

  (0 until n-1)./:(a.head)((acc, i) => {
    tableL(i+1) = gcd(acc, a(i))
    tableL(i+1)
  })
  (n-1 to 1 by -1)./:(a.last)( (acc, i) => {
    tableR(i-1) = gcd(acc, a(i))
    tableR(i-1)
  })

  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)
  }
}