stringSplit :: String -> [String]
stringSplit string
    | otherwise = _stringSplit "" string

_stringSplit :: String -> String -> [String]
_stringSplit to from
    | from == ""        = [to]
    | head from == ' '  = (if to == "" then [] else [to]) ++ (_stringSplit "" $ tail from)
    | otherwise         = _stringSplit (to ++ [head from]) $ tail from

myGcd x y
    | y == 0    = x
    | otherwise = myGcd y $ x `mod` y

data Array = EmptyArray | ArrayNode {index :: Int, arrayValue :: Int, leftArray :: Array, rightArray :: Array} deriving (Show, Read, Eq, Ord)

newArray :: Int -> Int -> Array
newArray l r
    | r - l == 0 = ArrayNode l 0 EmptyArray EmptyArray
    | r - l == 1 = ArrayNode r 0 (newArray l l)         EmptyArray
    | otherwise  = ArrayNode m 0 (newArray l (m - 1))   (newArray (m + 1) r)
    where
        m = (l + r) `div` 2

valueOf :: Array -> Int -> Int
valueOf (ArrayNode index value leftArray rightArray) ind
    | index == ind = value
    | index <  ind = valueOf rightArray ind
    | index >  ind = valueOf leftArray  ind

replace :: Array -> Int -> Int -> Array
replace (ArrayNode index value leftArray rightArray) ind val
    | index == ind = ArrayNode index val   leftArray                    rightArray
    | index <  ind = ArrayNode index value leftArray                    (replace rightArray ind val)
    | index >  ind = ArrayNode index value (replace leftArray ind val)  rightArray

turnListToArray :: [Int] -> Array
turnListToArray xxs
    | otherwise = _turnListToArray (newArray 0 (len + 1)) xxs 1 len
    where
        len = length xxs 

_turnListToArray :: Array -> [Int] -> Int -> Int -> Array
_turnListToArray array xxs l r
    | l > r     = array
    | otherwise = _turnListToArray (replace array l x) xs (l + 1) r
    where
        (x : xs) = xxs

--------------------------------------------------

leftGcd :: Array -> Array -> Int -> Int -> Array
leftGcd ret from l r
    | l > r     = ret
    | otherwise = leftGcd (replace ret l (myGcd (valueOf from l) (valueOf ret (l - 1)))) from (l + 1) r

rightGcd :: Array -> Array -> Int -> Int -> Array
rightGcd ret from l r
    | l > r     = ret
    | otherwise = rightGcd (replace ret r (myGcd (valueOf from r) (valueOf ret (r + 1)))) from l (r - 1)

getAns :: Array -> Array -> Int -> Int -> Int
getAns left right i n
    | i > n     = 0
    | otherwise = max (myGcd (valueOf left (i - 1)) (valueOf right (i + 1))) (getAns left right (i + 1) n)

_solve = do
    inputN <- getLine
    inputA <- getLine
    let
        n = read inputN
        a = map read (stringSplit inputA)
        arr = turnListToArray a
        left = leftGcd (newArray 0 n) arr 1 n
        right = rightGcd (newArray 1 (n + 1)) arr 1 n
        ans = getAns left right 1 n
    putStr $ show ans
    return ()

--------------------------------------------------

solve t
    | t == 0 = do
        return ()
    | otherwise = do
        _solve
        putStr "\n"
        solve (t - 1)

main = do
    -- t <- getLine
    solve (1)
    return ()