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)
    }

    def gcdArray(xs: Seq[Long]): Long = {
      if (xs.size == 1) {
        xs.head
      } else {
        xs.reduce((x, y) => gcd(x, y))
      }
    }

    def remove(xs: Seq[Long], i: Int): Seq[Long] = {
      xs.take(i) ++ xs.drop(i + 1)
    }

    var result = 0L
    for (i <- 0 until N) {
      val gcd = gcdArray(remove(A, i))
      if (result < gcd) {
        result = gcd
      }
    }

    println(result)
  }
}
