import scala.io.StdIn

object Main {
    def main(args: Array[String]): Unit = {
        val n = StdIn.readLine.toInt
        val as = StdIn.readLine.split(" ").map(_.toInt)

        println((0 until n).toSeq.combinations(2).map({case Vector(i: Int, j: Int) => gcd(as(i), as(j))}).max)
    }

    def gcd(a: Int, b: Int): Int = if (b == 0) a else gcd(b, a % b)
}