n = int(eval(input()))

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

a.sort()



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

    while 0 != a[i - 1]:

        r = a[i] % a[i - 1]

        a[i] = a[i - 1]

        a[i - 1] = r

print((a[-1]))

n = int(eval(input()))

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





def gcd(a, b):

    r = a % b

    if 0 == r:

        return b

    else:

        return gcd(b, r)





def gcd_for_arr(l):

    tmp = gcd(l[0], l[1])

    for i in range(2, len(l)):

        tmp = gcd(tmp, l[i])

    return tmp





print((gcd_for_arr(a)))

n = int(eval(input()))
a = list(map(int, input().split()))
a.sort()
for i in range(1, len(a)):
    while 0 != a[i - 1]:
        r = a[i] % a[i - 1]
        a[i] = a[i - 1]
        a[i - 1] = r
print((a[-1]))

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


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


def gcd_for_arr(l):
    tmp = gcd(l[0], l[1])
    for i in range(2, len(l)):
        tmp = gcd(tmp, l[i])
    return tmp


print((gcd_for_arr(a)))

-a.sort() -for i in range(1, len(a)): -    while 0 != a[i - 1]: -        r = a[i] % a[i - 1] -        a[i] = a[i - 1] -        a[i - 1] = r -print((a[-1])) + + +def gcd(a, b): +    r = a % b +    if 0 == r: +        return b +    else: +        return gcd(b, r) + + +def gcd_for_arr(l): +    tmp = gcd(l[0], l[1]) +    for i in range(2, len(l)): +        tmp = gcd(tmp, l[i]) +    return tmp + + +print((gcd_for_arr(a)))