module Main where


solve :: [Integer] -> Integer
solve a =
    let accl = scanl gcd 0 a
        accr = scanl gcd 0 (reverse a)
        n    = length a
        list = [ gcd (accl !! i) (accr !! (n - i-1)) | i <- [0 .. n - 1] ]
    in  maximum list

main :: IO ()
main = do
    getLine
    a <- (map read . words) <$> getLine
    putStrLn $show $ solve a
