program sample
    implicit none
    character(100)::s,t
    integer(8) :: i,j,k,m,n
    integer(8)::a,b,c,d
    integer(8),allocatable::x(:),y(:)
  
    read(*,*) n
    allocate(x(n))
    read(*,*)x
    a=x(1)
    do i=2,n
        b=max(a,x(i))

            c=min(a,x(i))
        do j=1,40
            if(mod(b,c)==0)then
            a=c
            exit
            else
                a=mod(b,c)
                b=c
                c=a
            end if
        end do
        if(a==1)then
            write(*,*)1
            stop
        end if
    end do
    write(*,*)a

    stop
end program sample
  

