main = do
    n <- getLine
    as <- (map read) <$> words <$> getLine :: IO [Int]
    let left = scanl gcd 0 as
    let right = scanr gcd 0 as
    let res = zipWith gcd left (tail right)
    print $ maximum res