program test 
implicit none
integer(8) :: n,a(100000)
integer(8) :: i,j,k,aa,bb,cc

read(*,*) n
read(*,*) (a(i),i=1,n)

do i=1,n-1
	aa = max(a(i),a(i+1))
	bb = min(a(i),a(i+1))
	
	do while(aa*bb > 0)
		cc = mod(aa,bb)
		aa = bb
		bb = cc
	enddo
	
	a(i+1) = max(aa,bb)
enddo

write(*,*) a(n)


end program