import qualified Data.ByteString.Char8 as BC
import Data.Maybe

readIntsLine :: IO [Int]
readIntsLine = map (fst . fromJust . BC.readInt) . BC.words <$> BC.getLine

solve :: [Int] -> Int
solve [a1, a2] = gcd a1 a2
solve (a1:a2:as) = solve $ gcd a1 a2 : as

main :: IO ()
main = do
  getLine
  as <- readIntsLine
  print $ solve as