import scala.annotation.tailrec

object Main{
	@tailrec
	def gcd(a:Int,b:Int):Int ={
		if(b==0) a
		else if(a % b == 0) b else gcd(b,a % b)
	}
	def main(args:Array[String]){
		val s = new java.util.Scanner(System.in)
		val n = s.nextInt
		val a = Array.fill(n)(s.nextInt)
		val l,r = Array.fill(n + 2)(0)
		for(i <- 1 to n)
			l(i) = gcd(l(i - 1),a(i - 1))
		for(i <- n to 1 by -1)
			r(i) = gcd(r(i + 1),a(i - 1))
		println((1 to n).map(i => gcd(l(i - 1),r(i + 1))).max)
	}
}