import java.util.*

fun main(args:Array<String>){
    val n = readLine()!!.toInt()
    val a = readLine()!!.split(" ").map{it.toInt()}
    val sum1 = IntArray(n)
    val sum2 = IntArray(n)
    sum1[0] = a[0]
    for(i in 1 until n){
        sum1[i] = gcd(sum1[i - 1], a[i])
    }
    sum2[n - 1] = a[n - 1]
    for(i in n - 2 downTo 0){
        sum2[i] = gcd(sum2[i + 1], a[i])
    }
    var ans = 0
    for(i in 0 until n){
        if(i == 0){
            ans = Math.max(ans, sum2[1])
        }
        else if(i == n - 1){
            ans = Math.max(ans, sum1[n - 2])
        }
        else{
            ans = Math.max(ans, gcd(sum1[i - 1], sum2[i + 1]))
        }
    }
    println(ans)
}

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