module Main where


solve :: [Integer] -> Integer
solve a =
    let accl =0 : scanl gcd 0 a
        accr =reverse $ scanl gcd 0 (reverse a)
    in  maximum $ zipWith gcd accl accr

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