from collections import deque

N = int(eval(input()))

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



while True:

    if len(A) == 1:

        break

    while A[0] == 0:

        A.popleft()

    mod = A[0]

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

        A[i] = A[i]%mod

    A = deque(sorted(A))



print((A[0]))
from fractions import gcd



N = int(eval(input()))

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

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

for a in A[2:]:

    g = gcd(g, a)



print(g)
from collections import deque

N = int(eval(input()))
A = deque(sorted(list(map(int, input().split()))))
while True:
    if len(A) == 1:
        break
    while A[0] == 0:
        A.popleft()
    mod = A[0]
    for i in range(1, len(A)):
        A[i] = A[i] % mod
    A = deque(sorted(A))
print((A[0]))

from fractions import gcd

N = int(eval(input()))
A = list(map(int, input().split()))
g = gcd(A[0], A[1])
for a in A[2:]:
    g = gcd(g, a)
print(g)

-from collections import deque +from fractions import gcd -A = deque(sorted(list(map(int, input().split())))) -while True: -    if len(A) == 1: -        break -    while A[0] == 0: -        A.popleft() -    mod = A[0] -    for i in range(1, len(A)): -        A[i] = A[i] % mod -    A = deque(sorted(A)) -print((A[0])) +A = list(map(int, input().split())) +g = gcd(A[0], A[1]) +for a in A[2:]: +    g = gcd(g, a) +print(g)