import java.util.Scanner

import scala.annotation.tailrec

object Main {
  def main(args: Array[String]) = {
    val sc = new Scanner(System.in)
    val N = sc.nextInt()
    val As = List.fill(N)(sc.nextInt())

    val left = As.scanLeft(0) {(pre, x) => gcd(pre, x)}
    val right = As.scanRight(0) {(pre, x) => gcd(pre, x)}

    val ret = 0.until(As.size + 1).map {i =>
      gcd(left(i), right(i + 1))
    }.max
    println(s"$ret")
  }

  @tailrec
  def gcd(x: Int, y: Int): Int = {
    if(y == 0) x
    else gcd(y, (x % y))
  }
}