n = int(input())
a = list(map(int, input().split()))
if max(a) != min(a):
    while a.count(0) != len(a)-1:
        a.sort()
        b = [a[0]]
        for i in a[1:]:
            if i%a[0] != 0:
                b.append(i%a[0])
        a = b
    print(max(a))
else:
    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 if max(a) != min(a):
    while a.count(0) != len(a)-1:
        a.sort()
        b = [a[0]]
        for i in a[1:]:
            if i%a[0] != 0:
                b.append(i%a[0])
        a = b
    print(max(a))
else:
    print(a[0]) max(a) != min(a) max(a) max a min(a) min a while a.count(0) != len(a)-1:
        a.sort()
        b = [a[0]]
        for i in a[1:]:
            if i%a[0] != 0:
                b.append(i%a[0])
        a = b
     a.count(0) != len(a)-1 a.count(0) a.count a count 0 len(a)-1 len(a) len a 1 a.sort() a.sort a sort b = [a[0]] b [a[0]] a[0] a 0 for i in a[1:]:
            if i%a[0] != 0:
                b.append(i%a[0])
         i a[1:] a 1: 1 if i%a[0] != 0:
                b.append(i%a[0])
         i%a[0] != 0 i%a[0] i a[0] a 0 0 b.append(i%a[0]) b.append b append i%a[0] i a[0] a 0 a = b a b print(max(a)) print max(a) max a print(a[0]) print a[0] a 0 b = [a[0]] [a[0]] b n = int(input()) int(input()) n a = list(map(int, input().split())) list(map(int, input().split())) a a = b b a
n = int(input())
a = list(map(int, input().split()))
if max(a) != min(a):
    while a.count(0) != len(a)-1:
        a.sort()
        b = [a[0]]
        for i in a[1:]:
            if i%a[0] != 0:
                b.append(i%a[0])
        a = b
    print(max(a))
else:
    print(a[0])