N = int(eval(input()))

A = list(map(int, input().split()))



while len(A) > 1:

  A.sort()

  #print(A)

  for i in range(1,len(A)):

    #print(A[i],A[0])

    A[i] = A[i] % A[0]

  A = list([x for x in A if x != 0])



print((A[0]))
# GCD: greatest common divisor

from fractions import gcd

N = int(eval(input()))

A = list(map(int, input().split()))



ans = gcd(A[0],A[1])

for i in range(1,N-1):

  ans = gcd(ans,A[i+1])

  

print(ans)
N = int(eval(input()))
A = list(map(int, input().split()))
while len(A) > 1:
    A.sort()
    # print(A)
    for i in range(1, len(A)):
        # print(A[i],A[0])
        A[i] = A[i] % A[0]
    A = list([x for x in A if x != 0])
print((A[0]))

# GCD: greatest common divisor
from fractions import gcd

N = int(eval(input()))
A = list(map(int, input().split()))
ans = gcd(A[0], A[1])
for i in range(1, N - 1):
    ans = gcd(ans, A[i + 1])
print(ans)

+# GCD: greatest common divisor +from fractions import gcd + -while len(A) > 1: -    A.sort() -    # print(A) -    for i in range(1, len(A)): -        # print(A[i],A[0]) -        A[i] = A[i] % A[0] -    A = list([x for x in A if x != 0]) -print((A[0])) +ans = gcd(A[0], A[1]) +for i in range(1, N - 1): +    ans = gcd(ans, A[i + 1]) +print(ans)