import           Data.List -- sort
import           Control.Monad -- replicateM

readInt = read <$> getLine :: IO Integer
arrayInt = map read . words <$> getLine :: IO [Integer]
writeln x = putStrLn $ unwords x :: IO ()

main = do
    n <- readInt
    a <- arrayInt
    let l = scanl' gcd 0 a
    let r = reverse $ scanl' gcd 0 (reverse a)

    print $ foldl max 0
        [ gcd (l !! i) (r !! (i + 1)) | i <- [0 .. ((fromIntegral n) - 1)] ]
