fun main(args: Array<String>) {
  val n = Integer.parseInt(readLine() ?: "0")
  val alist = readLine()?.split(" ") ?: listOf()
  val a = alist.map{Integer.parseInt(it)}
  
  val l = IntArray(n)
  val r = IntArray(n)
 
  for (i in 0 until n) {
    l[i] = if (i == 0) {
      gcd(a[0], 0)
    } else {
      gcd(a[i], l[i - 1])
    }
  }
 
  for (i in n-1 downTo 0) {
    r[i] = if (i == n - 1) {
      gcd(a[i], 0)
    } else {
      gcd(a[i], r[i + 1])
    }
  }
 
  var ans = 0
  for (i in 0 until n) {
    val d = when (i) {
      0 -> r[i + 1]
      n - 1 -> l[i - 1]
      else -> gcd(l[i - 1], r[i + 1])
    }
    ans = Math.max(ans, d)
  }
  
  println(ans)
}

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