import scala.collection.mutable.ArrayBuffer

object Main {
  def main(args: Array[String]): Unit = {
    val lines = io.Source.stdin.getLines().toSeq
    println(solve(lines))
  }

  def solve(lines: Seq[String]): String = {
    val n = lines.head.toInt
    val a = lines.tail.head.split(" ").map(_.toLong).toIndexedSeq
    val divisors = IndexedSeq.concat(divisor(a(0)), divisor(a(n - 1))).distinct.sorted
    debug(n, a, divisors)
    divisors.filter(d => a.count(_ % d == 0) >= a.length - 1).max.toString
  }

  private def divisor(n: Long): IndexedSeq[Long] = {
    val buf = ArrayBuffer.empty[Long]
    for (i <- 1 to Math.sqrt(n).toInt) {
      if (n % i == 0) {
        buf.append(i)
        if (i * i != n) buf.append(n / i)
      }
    }
    buf.toIndexedSeq
  }

  private def debug(x: Any): Unit = {
    if (System.getenv("LOCAL_DEBUG") != null)
      println(x)
  }
}
