import heapq



N = int(eval(input()))

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



heapq.heapify(A)

flag = True



while flag:

    minA = heapq.heappop(A) # 最小値を取り出す

    if len(A) == 0: # 要素がなかったら終わり

        break

    if minA == 0: # 0だったら除外したまま続ける

        continue

    A = list([x % minA for x in A])

    heapq.heappush(A, minA)



print(minA)
N = int(eval(input()))

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



def gcd(a, b):

    if b == 0:

        return a

    else:

        return(gcd(b, a % b))



ans = A[0]

for i in range(1, N):

    ans = gcd(ans, A[i])



print(ans)
import heapq

N = int(eval(input()))
A = list(map(int, input().split()))
heapq.heapify(A)
flag = True
while flag:
    minA = heapq.heappop(A)  # 最小値を取り出す
    if len(A) == 0:  # 要素がなかったら終わり
        break
    if minA == 0:  # 0だったら除外したまま続ける
        continue
    A = list([x % minA for x in A])
    heapq.heappush(A, minA)
print(minA)

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


def gcd(a, b):
    if b == 0:
        return a
    else:
        return gcd(b, a % b)


ans = A[0]
for i in range(1, N):
    ans = gcd(ans, A[i])
print(ans)

-import heapq - -heapq.heapify(A) -flag = True -while flag: -    minA = heapq.heappop(A)  # 最小値を取り出す -    if len(A) == 0:  # 要素がなかったら終わり -        break -    if minA == 0:  # 0だったら除外したまま続ける -        continue -    A = list([x % minA for x in A]) -    heapq.heappush(A, minA) -print(minA) + + +def gcd(a, b): +    if b == 0: +        return a +    else: +        return gcd(b, a % b) + + +ans = A[0] +for i in range(1, N): +    ans = gcd(ans, A[i]) +print(ans)