main :: IO ()
main = do
  _ <- getLine
  as <- map read . words <$> getLine
  print $ solve as

solve :: [Int] -> Int
solve as = maximum $ zipWith gcd ls rs
  where
    ls = scanl gcd 0 as
    rs = tail $ reverse $ scanl1 gcd $ reverse as