n=int(eval(input()))

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

a.sort()



while len(a)>=2:

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

    a[i]=a[i]%a[0]

  if 0 in a:

    for j in range(a.count(0)):

      a.remove(0)

  a.sort()

    



print((a[0]))



n=int(eval(input()))

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

def gcd(x,y):

  if x%y==0:

    return y

  else:

    return gcd(y,x%y)

  

b=a[0]

  

for i in range(1,n):

  b=gcd(b,a[i])

  

print(b)  

  
n = int(eval(input()))
a = list(map(int, input().split()))
a.sort()
while len(a) >= 2:
    for i in range(1, len(a)):
        a[i] = a[i] % a[0]
    if 0 in a:
        for j in range(a.count(0)):
            a.remove(0)
    a.sort()
print((a[0]))

n = int(eval(input()))
a = list(map(int, input().split()))


def gcd(x, y):
    if x % y == 0:
        return y
    else:
        return gcd(y, x % y)


b = a[0]
for i in range(1, n):
    b = gcd(b, a[i])
print(b)

-a.sort() -while len(a) >= 2: -    for i in range(1, len(a)): -        a[i] = a[i] % a[0] -    if 0 in a: -        for j in range(a.count(0)): -            a.remove(0) -    a.sort() -print((a[0])) + + +def gcd(x, y): +    if x % y == 0: +        return y +    else: +        return gcd(y, x % y) + + +b = a[0] +for i in range(1, n): +    b = gcd(b, a[i]) +print(b)