

import numpy as np





def submit():

    n = int(eval(input()))

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



    while True:

        curr_idx = np.argmin(alist)

        curr_min = alist[curr_idx]



        surplus_sum = 0

        for i in range(len(alist)):

            if i == curr_idx:

                continue

            alist[i] %= curr_min

            surplus_sum += alist[i]



        if surplus_sum == 0:

            print(curr_min)

            break



        alist = [a for a in alist if a]

    



if __name__ == "__main__":

    submit()


import numpy as np





def gcd(a, b):

    if b == 0:

        return a

    return gcd(b, a % b)





def submit():

    n = int(eval(input()))

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



    g = alist[0]

    for a in alist[1:]:

        g = gcd(g, a)



    print(g)

    



if __name__ == "__main__":

    submit()
import numpy as np


def submit():
    n = int(eval(input()))
    alist = list(map(int, input().split()))
    while True:
        curr_idx = np.argmin(alist)
        curr_min = alist[curr_idx]
        surplus_sum = 0
        for i in range(len(alist)):
            if i == curr_idx:
                continue
            alist[i] %= curr_min
            surplus_sum += alist[i]
        if surplus_sum == 0:
            print(curr_min)
            break
        alist = [a for a in alist if a]


if __name__ == "__main__":
    submit()

import numpy as np


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


def submit():
    n = int(eval(input()))
    alist = list(map(int, input().split()))
    g = alist[0]
    for a in alist[1:]:
        g = gcd(g, a)
    print(g)


if __name__ == "__main__":
    submit()

+ + +def gcd(a, b): +    if b == 0: +        return a +    return gcd(b, a % b) -    while True: -        curr_idx = np.argmin(alist) -        curr_min = alist[curr_idx] -        surplus_sum = 0 -        for i in range(len(alist)): -            if i == curr_idx: -                continue -            alist[i] %= curr_min -            surplus_sum += alist[i] -        if surplus_sum == 0: -            print(curr_min) -            break -        alist = [a for a in alist if a] +    g = alist[0] +    for a in alist[1:]: +        g = gcd(g, a) +    print(g)