import Data.Array

gcdlist'::Int->[Int]->Int
gcdlist' n [] = n
gcdlist' n (x:xs) = gcdlist' (gcd n x) xs

gcdlist::[Int]->Int
gcdlist ls = gcdlist' (head ls) (tail ls)

gen_ar::Int->[Int]->Array Int Int
gen_ar n ls = listArray (1,n) ls

gcd_dropping::Array Int Int -> Int -> Int
gcd_dropping ar i =gcdlist [ar!j |j <- ((filter (i/=)) (indices ar))]

solver::Int->[Int]->Int
solver n ls = maximum [gcd_dropping (gen_ar n ls) i |i<-[1..n]]

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