import Data.List
main :: IO()
main = do
  _ <- getLine
  a <- map read . words <$> getLine
  print $ slv a

slv :: [Integer] -> Integer
slv a | length a == 2 = maximum a
      | otherwise = proc a [] $ 0
 
proc :: [Integer] -> [Integer] -> Integer -> Integer
proc [] _ ret = ret
proc (a:aa:as) n ret = proc (aa:as) (a:n) (max gcds ret)
  where gcds = foldl (gcd) aa $ as ++ n
proc (a:as) (n:ns) ret = max ret $ foldl (gcd) n ns
