module Main where
import Control.Monad
import Data.Maybe
import qualified Data.ByteString.Char8 as BS
tuplify2 (x:y:_) = (x,y)
tuplify2 _ = undefined


readInt = fst . fromJust . BS.readInteger
readIntTuple = tuplify2 . map readInt . BS.words
readIntList = map readInt . BS.words

getInt = readInt <$> BS.getLine
getIntList = readIntList <$> BS.getLine
getIntNList n = map readIntList <$> replicateM (fromIntegral n) BS.getLine
getIntMatrix = map readIntList . BS.lines <$> BS.getContents
getIntTuple = readIntTuple <$> BS.getLine
getIntNTuples n = map readIntTuple <$> replicateM (fromIntegral n) BS.getLine
getIntTuples = map readIntTuple . BS.lines <$> BS.getContents

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 <- getIntList
    putStrLn $ show $ solve a
