main :: IO ()
main = do
  n <- readLn :: IO Int
  as <- fmap (map read . words) getLine :: IO [Int]
  print $ solve as

solve as = maximum $ zipWith gcd ls rs
  where
    ls = init $ scanl' gcd 0 as
    rs = tail $ scanr gcd 0 as
