main :: IO ()
main = do
  n <- read <$> getLine :: IO Int
  as <- map read . words <$> getLine :: IO [Int]
  let
    ls = init . scanl gcd 0 $ as :: [Int]
    rs = tail . scanr gcd 0 $ as :: [Int]
    m = maximum $ zipWith gcd ls rs :: Int
  print m
