import Control.Monad
import Data.Maybe
import qualified Data.ByteString.Char8 as BS
import Data.List

readInt = fst . fromJust . BS.readInt
readIntList = map readInt . BS.words
getInt = readInt <$> BS.getLine
getIntList = readIntList <$> BS.getLine

main = do
    n <- getInt
    as <- getIntList
    let lgcd = scanl gcd' 0 as
    let rgcd = scanr gcd' 0 as
    let ans = maximum $ zipWith gcd' lgcd (tail rgcd)
    print ans

gcd' a 0 = a
gcd' 0 a = a
gcd' a b = gcd a b