program monsters_battle_royale
  implicit none
  integer :: n, a(100000) = 0, i, g
  read(*,*) n
  read(*,*) a(1:n)
  g = a(1)
  do i = 2, n
    g = gcd(g,a(i))
  end do
  write(*,'(i0)') g
contains
  integer function gcd(a,b)
    integer, intent(in) :: a, b
    integer :: x, y
    x = max(a,b)
    y = min(a,b)
    do while (y > 0)
      gcd = y
      y = mod(x,y)
      x = gcd
    end do
  end
end program monsters_battle_royale