main = do
  n <- read <$> getLine
  as <- map read . words <$> getLine
  putStrLn . show $ solve n as

solve :: Int -> [Integer] -> Integer
solve n (x:y:xs) =
  if n == 2 then
    max x y
  else
    inSolve (gcd (gcd x y) (head xs)) (maximum [gcd x y,gcd y (head xs), gcd (head xs) x]) (tail xs)

inSolve :: Integer -> Integer -> [Integer] -> Integer
inSolve allgcd minusOne [] = minusOne
inSolve allgcd minusOne (x:xs)=
  let cand = max allgcd (gcd minusOne x)
  in (inSolve (gcd allgcd x) cand xs)
