import java.util.Scanner

object Main extends App  {
  val sc = new Scanner(System.in)

  val n = sc.nextInt
  val al = List.fill(n)(sc.nextInt)

  val gcdL = al.foldLeft(Vector.empty[Int]){case (vec,a) =>
      if (vec.isEmpty) Vector(a)
      else vec :+ gcd(vec.last, a)
  }

  val gcdR = al.foldRight(Vector.empty[Int]){case (a,vec) =>
    if (vec.isEmpty) Vector(a)
    else vec :+ gcd(vec.last, a)
  }.reverse

//  gcdL.foreach(w => print(s"$w "))
//  println
//
//  gcdR.foreach(w => print(s"$w "))
//  println

  val res = (0 until n).foldLeft(1){case (max,k) =>
    val temp =
      k match{
        case 0     => gcdR(1)
        case x if x == n - 1 => gcdL(x - 1)
        case x     => gcd(gcdL(x - 1), gcdR(x + 1))
      }
//    println(s"temp = $temp")
    Math.max(temp, max)
  }

  println(res)


  def gcd(a: Int, b: Int): Int ={
    (a,b) match{
      case (x,y) if y == 0 => x
      case (x,y) if x < y  => gcd(y, x)
      case (x,y)           => gcd(y, x % y)
    }
  }

}
