import qualified Data.Vector.Unboxed as U

main = do
    n <- readLn
    as <- U.fromListN n . map read. words <$> getLine :: IO (U.Vector Int)
    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