object Main {
  def main(args: Array[String]): Unit = {
    val lines = io.Source.stdin.getLines().toSeq
    println(solve(lines))
  }

  def solve(lines: Seq[String]): String = {
    val n = lines.head.toInt
    val values = lines(1).split(" ").take(n).map(_.toLong).toSeq

    if (values.min == values.max) {
      values.max.toString
    } else {
      var result = 0L
      for (i <- values.indices) {
        val vs =
          if (i == 0) {
            values.slice(1, values.size)
          } else if (i == values.size - 1) {
            values.slice(0, values.size - 1)
          } else {
            values.slice(0, i) ++: values.slice(i + 1, values.size)
          }
        for (j <- 1 until vs.size) {
          val g = gcd(vs(j), vs(j - 1))
          if (g > result) result = g
        }
      }
      result.toString
    }
  }

  def gcd(a: Long, b: Long): Long = {
    if (b == 0) a else gcd(b, a % b)
  }
}
