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

a.sort()

def mod():
    for i in range(1, len(a)):
        # print("--------")
        # print(a[i])
        # print(a[i] % a[0])
        # print("--------")
        if(a[i] % a[0] != 0):
            a[i] = a[i] % a[0]
        else:
            a[i] = a[0]
        # print(a[i])
    a.sort()
    return a

# for i in range(4):
#     a = mod()
#     print(a)

while(a.count(a[0]) != len(a)):
    a = mod()
    # print(a)

print(a[0]) n = int(input()) n int(input()) int input() input a = list(map(int,input().split())) a list(map(int,input().split())) list map(int,input().split()) map int input().split() ().split () input split a.sort() a.sort a sort def mod():
    for i in range(1, len(a)):
        # print("--------")
        # print(a[i])
        # print(a[i] % a[0])
        # print("--------")
        if(a[i] % a[0] != 0):
            a[i] = a[i] % a[0]
        else:
            a[i] = a[0]
        # print(a[i])
    a.sort()
    return a

# for i in range(4):
#     a = mod()
#     print(a) mod for i in range(1, len(a)):
        # print("--------")
        # print(a[i])
        # print(a[i] % a[0])
        # print("--------")
        if(a[i] % a[0] != 0):
            a[i] = a[i] % a[0]
        else:
            a[i] = a[0]
        # print(a[i])
     i range(1, len(a)) range 1 len(a) len a if(a[i] % a[0] != 0):
            a[i] = a[i] % a[0]
        else:
            a[i] = a[0]
        # print(a[i])
     a[i] % a[0] != 0 a[i] % a[0] a[i] a i a[0] a 0 0 a[i] = a[i] % a[0] a[i] a i a[i] % a[0] a[i] a i a[0] a 0 a[i] = a[0] a[i] a i a[0] a 0 a.sort() a.sort a sort return a a while(a.count(a[0]) != len(a)):
    a = mod()
    # print(a) a.count(a[0]) != len(a) a.count(a[0]) a.count a count a[0] a 0 len(a) len a a = mod() a mod() mod print(a[0]) print a[0] a 0 a = list(map(int,input().split())) list(map(int,input().split())) a def mod():
    for i in range(1, len(a)):
        # print("--------")
        # print(a[i])
        # print(a[i] % a[0])
        # print("--------")
        if(a[i] % a[0] != 0):
            a[i] = a[i] % a[0]
        else:
            a[i] = a[0]
        # print(a[i])
    a.sort()
    return a

# for i in range(4):
#     a = mod()
#     print(a) def mod():
    for i in range(1, len(a)):
        # print("--------")
        # print(a[i])
        # print(a[i] % a[0])
        # print("--------")
        if(a[i] % a[0] != 0):
            a[i] = a[i] % a[0]
        else:
            a[i] = a[0]
        # print(a[i])
    a.sort()
    return a

# for i in range(4):
#     a = mod()
#     print(a) mod n = int(input()) int(input()) n a = mod() mod() a
n = int(input())
a = list(map(int,input().split()))

a.sort()

def mod():
    for i in range(1, len(a)):
        # print("--------")
        # print(a[i])
        # print(a[i] % a[0])
        # print("--------")
        if(a[i] % a[0] != 0):
            a[i] = a[i] % a[0]
        else:
            a[i] = a[0]
        # print(a[i])
    a.sort()
    return a

# for i in range(4):
#     a = mod()
#     print(a)

while(a.count(a[0]) != len(a)):
    a = mod()
    # print(a)

print(a[0])