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

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

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