from heapq import heappop,heappush
N = int(input())
A = list(map(lambda x: -1*int(x),input().split()))

now = -1 * heappop(A)
while(A):
    next = -1 * heappop(A)
    if now % next != 0:
        heappush(A,-1*(now%next))
    now = next
print(now) from heapq import heappop,heappush N = int(input()) N int(input()) int input() input A = list(map(lambda x: -1*int(x),input().split())) A list(map(lambda x: -1*int(x),input().split())) list map(lambda x: -1*int(x),input().split()) map lambda x: -1*int(x) -1*int(x) -1 int(x) int x x input().split() ().split () input split now = -1 * heappop(A) now -1 * heappop(A) -1 heappop(A) heappop A while(A):
    next = -1 * heappop(A)
    if now % next != 0:
        heappush(A,-1*(now%next))
    now = next A next = -1 * heappop(A) next -1 * heappop(A) -1 heappop(A) heappop A if now % next != 0:
        heappush(A,-1*(now%next))
     now % next != 0 now % next now next 0 heappush(A,-1*(now%next)) heappush A -1*(now%next) -1 now%next now next now = next now next print(now) print now now = -1 * heappop(A) -1 * heappop(A) now now = next next now A = list(map(lambda x: -1*int(x),input().split())) list(map(lambda x: -1*int(x),input().split())) A next = -1 * heappop(A) -1 * heappop(A) next N = int(input()) int(input()) N
from heapq import heappop,heappush
N = int(input())
A = list(map(lambda x: -1*int(x),input().split()))

now = -1 * heappop(A)
while(A):
    next = -1 * heappop(A)
    if now % next != 0:
        heappush(A,-1*(now%next))
    now = next
print(now)