N=string.match(io.read(),"%d+")
A={}
k=1
for i in string.gmatch(io.read(),"%d+") do
	A[k]=i
  	k=k+1
end
table.sort(A)
function mod()
    while A[#A-1]~=0 do
       
        local index=0
        for i=1,#A do
            if A[i]~=0 then
                if A[i]==1 then
                    return 1
                end
                index=i
                break
            end
        end
        for i=index,#A-1 do
            A[i+1]=A[i+1]%A[i]
        end
     table.sort(A)
    end
    return A[#A]
end
print(mod())