program ccc
implicit none

integer(8) :: n, i, p, q
integer(8),allocatable,dimension(:) :: a

read*, n
allocate(a(n))
read*, a

p=minval(a)
q=maxval(a)
do while(p/=q)
p=minval(a)
do i=1,n
if(mod(a(i),p)==0) then
a(i)=p
else
a(i)=mod(a(i),p)
end if
end do
q=minval(a)
end do

write(*,'(i0)') q

end program