main = do
  getLine
  as<-map read.words<$>getLine
  print $ solve as

solve :: [Int]->Int
solve as = maximum $ zipWith gcd' (scanl gcd' 0 as) (tail (scanr gcd' 0 as))
  where
  gcd' 0 a = a
  gcd' a 0 = a
  gcd' a b = gcd a b