main :: IO ()
main = do
  n <- (read :: String -> Int) <$> getLine
  ai <- map (read :: String -> Int) . words <$> getLine
  print $ ans ai

ans :: [Int] -> Int
ans ai = (\(_,xs) -> maximum xs) $ foldl func (0,[]) ai where
  func (h,xs) k = (gcd h k,h : foldl (\acc l -> if gcd k l == 1 then acc else gcd k l : acc) [] xs)