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

i = 0
while True:
    x = a[i+1] % a[i]
    if x < a[i]:
        a[i+1] = a[i]
        a[i] = x
        if a[i] == 0:
            i += 1
            if i == n-1:
                break
    else:
        break
print(a[i]) 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 i = 0 i 0 while True:
    x = a[i+1] % a[i]
    if x < a[i]:
        a[i+1] = a[i]
        a[i] = x
        if a[i] == 0:
            i += 1
            if i == n-1:
                break
    else:
        break True x = a[i+1] % a[i] x a[i+1] % a[i] a[i+1] a i+1 i 1 a[i] a i if x < a[i]:
        a[i+1] = a[i]
        a[i] = x
        if a[i] == 0:
            i += 1
            if i == n-1:
                break
    else:
        break x < a[i] x a[i] a i a[i+1] = a[i] a[i+1] a i+1 i 1 a[i] a i a[i] = x a[i] a i x if a[i] == 0:
            i += 1
            if i == n-1:
                break
     a[i] == 0 a[i] a i 0 i += 1 i 1 if i == n-1:
                break
     i == n-1 i n-1 n 1 break break print(a[i]) print a[i] a i i += 1 1 i a = list(map(int, input().split())) list(map(int, input().split())) a n = int(input()) int(input()) n i = 0 0 i x = a[i+1] % a[i] a[i+1] % a[i] x
n = int(input())
a = list(map(int, input().split()))
a.sort()

i = 0
while True:
    x = a[i+1] % a[i]
    if x < a[i]:
        a[i+1] = a[i]
        a[i] = x
        if a[i] == 0:
            i += 1
            if i == n-1:
                break
    else:
        break
print(a[i])
