import           Data.List                      ( foldl' )

main :: IO ()
main = do
    n  <- read <$> getLine :: IO Int
    as <- map read . words <$> getLine :: IO [Int]
    let ls = init $ foldl' (\b a -> gcd (head b) a : b) [0] as
        rs = init $ foldr (\a b -> gcd (head b) a : b) [0] as
        ms = zipWith gcd ls rs
    print (maximum ms)
