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

fun cumGcd(x: List<Int>): List<Int> {
    var n = x.count()
    var res = x.toMutableList()

    res[0] = 0
    for (i in 0 until n - 1) {
        res[i + 1] = gcd(res[i], x[i])
    }
    return res
}

fun main(args: Array<String>) {
    var n = readLine()!!.toInt()
    var xs = readLine()!!.split(" ").map(String::toInt)
    var left = cumGcd(xs)
    var right = cumGcd(xs.reversed())
    var ans = 0
    for (i in 0 until n) {
        val g = gcd(left[i], right[n - 1 - i])
        if (ans < g) {
            ans = g
        }
    }
    println(ans)
}
