import qualified Data.Vector.Unboxed as U

main = do
    n <- getLine
    as <- U.fromList . 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