program monsters_battle_royale
  implicit none
  integer(8)              :: n, i, ans
  integer(8), allocatable :: a(:)
  read(*,*) n
  allocate(a(n))
  read(*,*) a(:)
  ans = a(1)
  do i = 1, n
     ans = gcd(a(i),ans)
  end do
  deallocate(a)
  write(*,'(i0)') ans
  stop
  
contains
  
  recursive function gcd(a0,b0) result(c)
    implicit none
    integer(8), intent(in) :: a0, b0
    integer(8)             :: a, b, c
    a = a0
    b = b0
    if (a .lt. b) call swap(a,b)
    if (mod(a,b) .eq. 0) then
       c = b
    else
       c = gcd(b,a-b*(a/b))
    end if
  end function gcd
  
  subroutine swap(a,b)
    implicit none
    integer(8), intent(inout) :: a, b
    integer(8)                :: c
    c = a
    a = b
    b = c
    return
  end subroutine swap
  
end program monsters_battle_royale