import Data.Array
import Control.Monad
main = do
  length <- readLn
  as <- listArray (1,length) . map read . words <$> getLine
  gcds <- forM [1..length] $ \n -> do
    let as' = [as ! x| x <- [1..length], x /= n]
    return $ gcdAll 0 as'
  print $ maximum gcds
  
  
gcdAll 0 (x:y:zs) = gcdAll (gcd x y) zs
gcdAll acc [] = acc
gcdAll acc (x:xs) = gcdAll (gcd acc x) xs