fun main(args : Array<String>) {
    val N = readLine()!!.toInt()
    val A = readLine()!!.split(" ").map { it.toInt() }.toIntArray()
    A.sortDescending()

    fun gcd(a: Int, b: Int) : Int {
        if (b == 0) {
            return a
        }
        return gcd(b, a % b)
    }

    val L = mutableListOf<Int>()
    L.add(0)
    L.add(A[0])
    A.reduce { acc, l ->
        val res = gcd(acc, l)
        L.add(res)
        res
    }

    val R = mutableListOf<Int>()
    R.add(0)
    R.add(A[N - 1])
    A.reduceRight { acc, l ->
        val res = gcd(acc, l)
        R.add(res)
        res
    }
    R.reverse()

    var max = 0
    for (i in 0 until N) {
        max = Math.max(max, gcd(L[i], R[i+ 1]) )
    }
    println(max)
}