from fractions import gcd



N = int(eval(input()))

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



g = [0] * (N + 1)

for i in range(N):

    g[i+1] = gcd(g[i], A[i])



print((g[-1]))
from fractions import gcd



N = int(eval(input()))

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

g = 0

for i in range(N):

    g = gcd(g, A[i])



print(g)

from fractions import gcd

N = int(eval(input()))
A = list(map(int, input().split()))
g = [0] * (N + 1)
for i in range(N):
    g[i + 1] = gcd(g[i], A[i])
print((g[-1]))

from fractions import gcd

N = int(eval(input()))
A = list(map(int, input().split()))
g = 0
for i in range(N):
    g = gcd(g, A[i])
print(g)

-g = [0] * (N + 1) +g = 0 -    g[i + 1] = gcd(g[i], A[i]) -print((g[-1])) +    g = gcd(g, A[i]) +print(g)