import scala.io.StdIn
 
 
object Main extends App {
  val n  = StdIn.readLine().toInt
  val a  = StdIn.readLine().split(" ").map(_.toInt)
 
  def solve(a: Array[Int]): Int = {
 
    val b = a.scanLeft(0) {(acc, x) => gcd(acc, x)}
    val c = a.scanRight(0) {(acc, x) => gcd(acc, x)}
 
    val d = for (x <- 0 to a.length -1) yield {
      gcd(b(x), c(x + 1))
    }
    d.max
  }
 
  def gcd(x: Int, y: Int) :Int = {
    if (y == 0 ) x
    else gcd(y, (x % y))
  }
 
  println(solve(a))
 
}