import java.util.Scanner

import scala.collection.mutable.ArrayBuffer


object Main {
  def read() = {
    val sc = new Scanner(System.in)
    val n = sc.nextInt()
    val a = for (_ <- 0 until n) yield sc.nextLong()
    (n, a)
  }

  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
  }

  def solve(n: Int, a: IndexedSeq[Long]): Long = {
    val cand = IndexedSeq.concat(divisor(a(0)), divisor(a(1))).distinct.sorted

    def satysfies(x: Long): Boolean = {
      a.count(ae => ae % x == 0) >= a.length - 1
    }
    cand.filter(satysfies).max
  }

  def main(args: Array[String]): Unit = {
    val (n, a) = read()
    println(solve(n, a))
  }
}