-- リストの最小の値でその他の値を割ってそのあまりに書き換える　のを繰り返す

import Control.Applicative
import Data.List

main :: IO ()
main = do
  _ <- getLine
  ss <- map read . words <$> getLine
  putStrLn $ show (solve ss)

solve :: [Int] -> Int
solve ss = solve' (sort ss) where
  solve' :: [Int] -> Int
  solve' [x] = x
  solve' (x:xs) = solve' $ sort $ filter (/= 0) ([x] ++ map (\p -> p `mod` x) xs)

