
object Main {
  def main(args:Array[String]) = {
    var sc = new java.util.Scanner(System.in)
    var n = sc.nextInt
    var a = Array.fill(n)(sc.nextInt())
    var max = 0
    var gcdRecord = 0
    for(i <- 0 until n; j <- 0 until n-1){
        if(j != i && j != i-1){
            max = if(gcd(a(j), a(j+1)) > max) gcd(a(j), a(j+1)) else max;
        }else if(j == i-1 && j < n-2){
            max = if(gcd(a(j), a(j+2)) > max) gcd(a(j), a(j+2)) else max;
        }
    }
    if (n == 2){
        max = if(a(0) > a(1)) a(0) else a(1)
    }else if(n == 1){
        max = a(0)
    }
    println(max)
  }

  def gcd(x: Int, y: Int): Int = {
    if(y > x) gcd(y, x)
    else if(y == 0) x
    else gcd(y, (x % y))
  }
}