import scala.io.StdIn.readLine

object Main{
  def main(args: Array[String]): Unit ={
    val n : Int = readLine().toInt
    val A : Array[Int] = readLine().split(' ').map(_.toInt)
    println(new Solve(n, A).solve())
  }
}

class Solve(val n : Int, val A : Array[Int]){
  def gcd(a : Int, b : Int): Int = if(b == 0) a else gcd(b, a % b)
  val Front : Array[Int] = {
    val k : Array[Int] = Array.fill(n)(0)
    for(i <- 1 until n) k(i) = gcd(k(i-1), A(i-1))
    k
  }
  val Back : Array[Int] = {
    val k : Array[Int] = Array.fill(n)(0)
    for(i <- n-2 to 0 by -1) k(i) = gcd(A(i+1), k(i+1))
    k
  }
  def solve(idx : Int = 0, res : Int = -1) : Int = {
    if(idx == n) res
    else{
      val USA : Int = gcd(Front(idx), Back(idx))
      solve(idx + 1, if(USA > res) USA else res)
    }
  }
}