program main
implicit None
	integer(8)::n,p,q,i
	integer(8),allocatable::a(:)
	
	read*,n
	allocate(a(n))
	read*,a
	
	p = a(1)
	q = p
	
	do i = 1,n
		call euc(a(i),p,q)
		p = q
	enddo
	
	print"(i0)",p
	
end program main

subroutine euc(a1,b1,c)
implicit None
integer(8)::a1,b1,c,a,b
	! return GCD of a1 and b1 in c
	
	a = a1
	b = b1
	c = 1
	
	do while (a /=0 .and. b /= 0)
		if (a > b)then
			c = b
			a = mod(a,b)
			else
			c = a
			b = mod(b,a)
		endif
	enddo
end subroutine euc