import Data.Array

foldl_trace::(a->b->a)-> a -> [b] -> [a]
foldl_trace f initial []     = []
foldl_trace f initial (x:xs) = (f initial x):(foldl_trace f (f initial x) xs)

gcd_still::[Int]->[Int]
gcd_still (x:xs) = x:(foldl_trace gcd x xs)

solver::Int->[Int]->Int
solver n ls = let ar_1 = listArray (1,n) (gcd_still ls) in
              let ar_2 = listArray (1,n) (reverse (gcd_still (reverse ls))) in
              maximum ([gcd (ar_1!(i-1)) (ar_2!(i+1)) |i<-[2..(n-1)]]++[ar_1!(n-1) , ar_2!(2)])


main::IO()
main=do
  n<-return.read=<<getLine
  ls<-return.map read.words=<<getLine
  print (solver n ls)