import           Data.List -- sort
import           Control.Monad -- replicateM

readInt = read <$> getLine :: IO Integer
arrayInt = map read . words <$> getLine :: IO [Integer]
writeln x = putStrLn $ unwords x :: IO ()

main = do
    n <- readInt
    a <- arrayInt
    let l = scanl' gcd 0 a
    let r = scanr gcd 0 a

    print $ maximum $ zipWith gcd l (tail r)
