import scala.annotation.tailrec
import scala.io.StdIn._
object Main extends App {

  val n = readInt()
  val num = readLine.trim.split(' ').map(_.toInt)
  val fromLeft = num.clone()
  val fromRight = num.clone()
  for (i ← 1 until n) fromLeft(i) = gcd(fromLeft(i), fromLeft(i - 1))
  for (i ← 0 until n - 1) fromRight(i) = gcd(fromRight(i), fromRight(i + 1))

  var max = math.max(fromLeft(n - 2), fromRight(1))
  for (mid ← 1 until n - 1){
    val g = gcd(fromLeft(mid - 1), fromRight(mid + 1))
    if (max < g) max = g
  }
  println(max)

  @tailrec def gcd(a: Int, b: Int): Int = if (b == 0) a else gcd(b, a % b)
}

