fun main(args: Array<String>) {
    val n = readInputLine().toInt()
    val aList = readInputLine().split(" ").map { it.toInt() }
    
    val gcdl = mutableListOf<Int>()
    val gcdrTmp = mutableListOf<Int>()
    
    for (i in 0 until n) {
        if (i == 0) {
            gcdl.add(0)
        } else {
            gcdl.add(if (gcdl[i - 1] > aList[i - 1]) gcd(gcdl[i - 1], aList[i - 1]) else gcd(aList[i - 1], gcdl[i - 1]))
        }
    }
    
    for (i in 0 until n) {
        if (i == 0) {
            gcdrTmp.add(0)
        } else {
            gcdrTmp.add(if (gcdrTmp[i - 1] > aList[n - i]) gcd(gcdrTmp[i - 1], aList[n - i]) else gcd(aList[n - i], gcdrTmp[i - 1]))
        }
    }
    
    val gcdr = gcdrTmp.reversed()
    
    val gcdlr = gcdl.zip(gcdr)

    println(gcdlr.map { if (it.first > it.second) gcd(it.first, it.second) else gcd(it.second, it.first)}.max())
}

fun readInputLine(): String {
    return readLine()!!
}

fun gcd(a: Int, b: Int): Int {
    // a >= b とする
    if (b == 0) {
        return a
    }
    return gcd(b, a % b)
}
