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 m = foldl (*) 1 a
    let b = map (\x -> gcd (m `div` x) x) a
    let x = foldl min (b !! 0) b
    let c = f (zip [i|i<-[0..n-1]] b) x
    -- print b
    print $ foldl (gcd) (a !! fromIntegral (fst (c !! 0))) [a !! (fromIntegral (fst t)) | t <- c]


f ((a, x) : xs) y | x == y    = xs
                  | otherwise = (a,x) : f xs y
