program atcoder
    implicit none
    integer(8) :: i,j,n,m,ans=0,k
    integer(8),allocatable,dimension(:) :: a,sum
    read*,n
    allocate(a(n))
    read(*,*)(a(j),j=1,n)
    ans = a(1)
    do i=2,n
        ans = gcd(ans,a(i))
    enddo
    write(*,'(i0)')ans
    stop 
contains
    function gcd(x,y)
        implicit none
        integer(8) :: gcd
        integer(8) :: x,y
        if(y>x)then
            gcd=x
            x=y
            y=gcd
        endif
        gcd = 1
        do while(gcd/=0)
            gcd = mod(x,y)
            x = y
            y = gcd
        enddo
        gcd = x
    end function gcd
end program atcoder