import scala.annotation.tailrec
import scala.collection.mutable.ArrayBuffer
import scala.io.StdIn._
object Main extends App {


  val n = readInt()
  val num = readLine.trim.split(' ').map(_.toInt)
  val segment = SegmentGCD(num)
  var max = math.max(segment.gcd(1, n), segment.gcd(0, n - 1))
  for (mid ← 1 until n - 1){
    val g = gcd(segment.gcd(0, mid), segment.gcd(mid + 1, n))
    if (max < g) max = g
  }
  println(max)

  @tailrec private[this] def gcd(a: Int, b: Int): Int = if (b == 0) a else gcd(b, a % b)
}
object SegmentGCD {
  def apply(numbers: Array[Int]): SegmentGCD = {
    val array = ArrayBuffer[Array[Int]](numbers)
    while(array.last.length != 1){
      array.append(Array.fill((array.last.length + 1) / 2){0})
    }
    for (i ← 1 until array.length; j ← array(i).indices){
      array(i)(j) = if (array(i - 1).length <= j * 2 + 1) array(i - 1)(j * 2)
      else gcd(array(i - 1)(j * 2), array(i - 1)(j * 2 + 1))
    }
    new SegmentGCD(array.toArray)
  }

  @tailrec def gcd(a: Int, b: Int): Int = if (b == 0) a else gcd(b, a % b)
}
class SegmentGCD private (private val array: Array[Array[Int]]) {
  def gcd(from: Int, until: Int): Int = {
    var result = array(0)(from)
    var begin = from
    var end = until - 1
    for (i ← array.indices if begin <= end) {
      if (begin % 2 == 1) {
        result = SegmentGCD.gcd(result, array(i)(begin))
      }
      if (end % 2 == 0){
        result = SegmentGCD.gcd(result, array(i)(end))
      }
      begin = (begin + 1) / 2
      if (end != 0) end = (end - 1) / 2
      else end = -2
    }
    result
  }
}