N = int(eval(input()))

A = [int(i) for i in input().split()]



A.sort()



num = 0



if N == A.count(A[0]):

    num = 1

else:

    l = A

    x = []



    while True:

        x = []

        x.append(l[0])

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

            if 0 < l[i] % l[0]:

                x.append(l[i] % l[0])



        if len(x) == 1:

            break



        x.sort()



        l = x



print((A[0] if num == 1 else x[0]))

from functools import reduce





def gcd(a, b):

    while b:

        a, b = b, a % b

    return a





def gcd_n(numbers):

    return reduce(gcd, numbers)





def main():

    N, *A = list(map(int, open(0).read().split()))

    print((gcd_n(A)))

    return





main()

N = int(eval(input()))
A = [int(i) for i in input().split()]
A.sort()
num = 0
if N == A.count(A[0]):
    num = 1
else:
    l = A
    x = []
    while True:
        x = []
        x.append(l[0])
        for i in range(1, len(l)):
            if 0 < l[i] % l[0]:
                x.append(l[i] % l[0])
        if len(x) == 1:
            break
        x.sort()
        l = x
print((A[0] if num == 1 else x[0]))

from functools import reduce


def gcd(a, b):
    while b:
        a, b = b, a % b
    return a


def gcd_n(numbers):
    return reduce(gcd, numbers)


def main():
    N, *A = list(map(int, open(0).read().split()))
    print((gcd_n(A)))
    return


main()

-N = int(eval(input())) -A = [int(i) for i in input().split()] -A.sort() -num = 0 -if N == A.count(A[0]): -    num = 1 -else: -    l = A -    x = [] -    while True: -        x = [] -        x.append(l[0]) -        for i in range(1, len(l)): -            if 0 < l[i] % l[0]: -                x.append(l[i] % l[0]) -        if len(x) == 1: -            break -        x.sort() -        l = x -print((A[0] if num == 1 else x[0])) +from functools import reduce + + +def gcd(a, b): +    while b: +        a, b = b, a % b +    return a + + +def gcd_n(numbers): +    return reduce(gcd, numbers) + + +def main(): +    N, *A = list(map(int, open(0).read().split())) +    print((gcd_n(A))) +    return + + +main()