import java.util.*

fun main(args: Array<String>) {
    val s = Scanner(System.`in`)
    val n = s.nextInt()
    val a = LongArray(n) { s.nextLong() }


    val h = LongArray(n)
    val t = LongArray(n)
    h[0] = a[0]
    t[n - 1] = a[n - 1]
    (1 until n).forEach { i ->
        h[i] = gcd(h[i - 1], a[i])
        t[n - 1 - i] = gcd(t[n - i], a[n - i - 1])
    }

    val ret = (0 until n)
        .map { index ->
            if (index == 0) t[1]
            else if (index == n - 1) h[n - 2]
            else gcd(h[index - 1], t[index + 1])
        }
        .max()


    println(ret)
}

fun gcd(a: Long, b: Long): Long {
    val x = Math.max(a, b)
    val y = Math.min(a, b)
    val c = x % y
    return if (c == 0L) y else gcd(y, c)
}