from queue import PriorityQueue

N = int(eval(input()))

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

q = PriorityQueue()

for a in A:

    q.put(-a)

x = -q.get()

while not q.empty():

    y = -q.get()

    if y == 0:

        break

    q.put(-(x % y))

    x = y

print(x)
from queue import PriorityQueue

N = int(eval(input()))

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

q = PriorityQueue()

for a in A:

  q.put(a)

x = q.get()

while not q.empty():

  y=q.get()

  if y == 0:

    continue

  q.put(x % y)

  x = y

print(x)
from queue import PriorityQueue

N = int(eval(input()))
A = list(map(int, input().split()))
q = PriorityQueue()
for a in A:
    q.put(-a)
x = -q.get()
while not q.empty():
    y = -q.get()
    if y == 0:
        break
    q.put(-(x % y))
    x = y
print(x)

from queue import PriorityQueue

N = int(eval(input()))
A = list(map(int, input().split()))
q = PriorityQueue()
for a in A:
    q.put(a)
x = q.get()
while not q.empty():
    y = q.get()
    if y == 0:
        continue
    q.put(x % y)
    x = y
print(x)

-    q.put(-a) -x = -q.get() +    q.put(a) +x = q.get() -    y = -q.get() +    y = q.get() -        break -    q.put(-(x % y)) +        continue +    q.put(x % y)