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 fl x = if x == 0 then 0 else gcd (a !! (x - 1)) (fl (x - 1))
    let fr x = if x == n
            then 0
            else gcd (a !! fromIntegral x) (fr $ fromIntegral (x + 1))
    let l = [ fl $ fromIntegral x | x <- [0 .. n] ]
    let r = [ fr $ fromIntegral x | x <- [0 .. n] ]

    -- print l
    -- print r
    print $ foldl max 0
        [ gcd (l !! i) (r !! (i + 1)) | i <- [0 .. ((fromIntegral n) - 1)] ]
