object Main extends App {
  val in = scala.io.Source.stdin.getLines.toSeq
  val ls = in.map(_.split(' ').map(_.toInt))
  val A = ls.tail.head
  val sorted = A.sorted

  private def gcd(a:Int, b:Int):Int = {
    //println(a, b)
    if(a==1 || b==1) return 1
    if(a < b) return gcd(b, a)
    if(a % b == 0) return b
    gcd(b, a - b)
  }
  val cand1 = (2 until sorted.size).foldLeft(0){ (a,i) =>
    //println(a)
    val g = gcd(sorted(1), sorted(i))
    //println("gcd:" + g)  
    Math.max(a, g)
  }
  val cand2 = (1 until sorted.size).foldLeft(Seq(0)){ (a,i) =>
    //println(a)
    val g = gcd(sorted(0), sorted(i))
    //println("gcd:" + g)
    val s = (a :+ g).sorted
    s.takeRight(2)
  }
  //println(cand1, cand2)
  val ret = Math.max(cand1, cand2.last)
  println(ret)
}
