import scala.io.StdIn.readLine
import scala.annotation.tailrec

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).YesWeCan())
  }
}

class Solve(val n : Int, val A : Array[Int]){
  @tailrec
  private def gcd(a : Int, b : Int): Int = if(b == 0) a else gcd(b, a % b)
  val Front : Array[Int] = new Array[Int](n)
  val Back : Array[Int] = new Array[Int](n)
  def prevS(): Unit ={
    Front(0) = 0; Back(n-1) = 0;
    for(i <- 1 until n) Front(i) = gcd(Front(i-1), A(i-1))
    for(i <- n - 2 to 0 by -1) Back(i) = gcd(A(i+1), Back(i+1))
  }
  def YesWeCan(): Int = {
    prevS()
    solve()
  }
  @tailrec
  private 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)
    }
  }
}