program main
integer::N,a,i,b,c,d
integer, allocatable :: j(:),k(:)
read(*, *) N
allocate(j(N))
read(*, *)(j(i), i=1,N)

a=minval(j)
c=0

do i=1,N
  b=mod(j(i),a)
  c=c+b
end do

if (c==0) then
  print*,a

 else
  do i=1,N
   k(i)=mysub(j(i),a)
  end do
 d=minval(k)
 print*,d
end if

contains
function mysub(x,y)
  integer:: x, y
  integer:: m, s, h
  read*,x,y
  ! step 1
  m = x
  s = y
  do
     ! step 2
     h=mod(m, s)
     ! step 3
     if (h == 0) then
        mysub=s
        exit
     end if
     ! step 4
     m = s
     s = h
  end do

  return
end function mysub

end program main