import scala.io.StdIn._

object Main extends App {

  val n = readInt()
  val A = readLine().split(" ").map(_.toInt)

  def solve() = {
    val max = A.max
    val arr = A.map(calcGCD(_, max)).sorted
    arr(1)
  }

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

  println(solve())

}

