n = int(eval(input()))

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



while True:

    index_list = [i for i, v in enumerate(monster) if v >0]

    mini = monster[index_list[0]]

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

        if mini > monster[index_list[i]]:

            mini =  monster[index_list[i]]



    miniindex_list = [i for i, v in enumerate(monster) if v ==mini]

    min_index = miniindex_list[0]



    for i in range(len(monster)):

        if not i == min_index:

            monster[i] = monster[i] % monster[min_index]

            

    non_zeroindex_list = [i for i, v in enumerate(monster) if v >0] 

    non_zeroindex = non_zeroindex_list[0]

    if len(non_zeroindex_list) == 1:

        break

print((monster[non_zeroindex]))
n = int(eval(input()))

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

def gcd(a, b):

    if b == 0:  

        return a

    else:

        return gcd(b, a%b)

gcd(4,2)



def gcd_more(a):

    ans = a[0]

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

        ans = gcd(ans, a[i])

    return ans

print((gcd_more(monsters)))
n = int(eval(input()))
monster = list(map(int, input().split()))
while True:
    index_list = [i for i, v in enumerate(monster) if v > 0]
    mini = monster[index_list[0]]
    for i in range(1, len(index_list)):
        if mini > monster[index_list[i]]:
            mini = monster[index_list[i]]
    miniindex_list = [i for i, v in enumerate(monster) if v == mini]
    min_index = miniindex_list[0]
    for i in range(len(monster)):
        if not i == min_index:
            monster[i] = monster[i] % monster[min_index]
    non_zeroindex_list = [i for i, v in enumerate(monster) if v > 0]
    non_zeroindex = non_zeroindex_list[0]
    if len(non_zeroindex_list) == 1:
        break
print((monster[non_zeroindex]))

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


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


gcd(4, 2)


def gcd_more(a):
    ans = a[0]
    for i in range(1, len(a)):
        ans = gcd(ans, a[i])
    return ans


print((gcd_more(monsters)))

-monster = list(map(int, input().split())) -while True: -    index_list = [i for i, v in enumerate(monster) if v > 0] -    mini = monster[index_list[0]] -    for i in range(1, len(index_list)): -        if mini > monster[index_list[i]]: -            mini = monster[index_list[i]] -    miniindex_list = [i for i, v in enumerate(monster) if v == mini] -    min_index = miniindex_list[0] -    for i in range(len(monster)): -        if not i == min_index: -            monster[i] = monster[i] % monster[min_index] -    non_zeroindex_list = [i for i, v in enumerate(monster) if v > 0] -    non_zeroindex = non_zeroindex_list[0] -    if len(non_zeroindex_list) == 1: -        break -print((monster[non_zeroindex])) +monsters = list(map(int, input().split())) + + +def gcd(a, b): +    if b == 0: +        return a +    else: +        return gcd(b, a % b) + + +gcd(4, 2) + + +def gcd_more(a): +    ans = a[0] +    for i in range(1, len(a)): +        ans = gcd(ans, a[i]) +    return ans + + +print((gcd_more(monsters)))