computeGreatestCommonFactor :: [Int] -> Int
computeGreatestCommonFactor list = foldr1 gcd list

solve :: [Int] -> Int
solve list = computeGreatestCommonFactor list

main :: IO ()
main = do
  _ <- getLine
  monsters <- map read . words <$> getLine
  print $ solve monsters