import Data.Char(isSpace)
import qualified Data.Vector.Unboxed as U
import qualified Data.ByteString.Char8 as C

main = do
    n <- readLn
    as <- U.unfoldrN n (C.readInt . C.dropWhile isSpace) <$> C.getLine
    let left = U.scanl' gcd 0 as
    let right = U.scanr' gcd 0 as
    let res = U.zipWith gcd left (U.tail right)
    print $ U.maximum res