object Main {

  def main(args: Array[String]): Unit = {

    val sc = new java.util.Scanner(System.in)
    val N = sc.nextInt
    val A = Array.fill(N)(sc.nextLong)

    def gcd(x: Long, y: Long): Long = {
      if (y == 0) x else gcd(y, x % y)
    }

    val L = new Array[Long](N + 1)
    L(0) = 0
    val R = new Array[Long](N + 1)
    R(N) = 0

    for (i <- 0 until N) {
      L(i + 1) = gcd(A(i), L(i))
    }

    for (i <- N - 1 to 0 by -1) {
      R(i) = gcd(A(i), R(i + 1))
    }

    var result = 0L

    for (i <- 0 until N) {
      val tmp = gcd(L(i), R(i + 1))
      if (result < tmp) {
        result = tmp
      }
    }

    println(result)
  }
}
