import Data.List
f::Int->Int->Int
f n m
   |(n `mod` m) == 0 =min n m
   |otherwise = f m (n `mod` m)

main = do
	   e<-getLine
	   es<-getLine
	   let x=read e::[Int]
	       xs=sort $ map read (words es)::[Int]
	   putStrLn $ show $ foldl1 f xs