integer N
integer,allocatable,dimension(:)::A
integer ans
read*,N
allocate(A(N))
read*,A

ans=A(1)
do i=2,N
  ans=gcd(ans,a(i))
end do

print"(i0)",ans

contains

pure function gcd(a,b)
integer,intent(in)::a,b
integer gcd
integer s,t
s=a
gcd=b

t=mod(s,gcd)
do while(t/=0)
  s=gcd
  gcd=t
  t=mod(s,gcd)
end do
end function gcd
end