CodeEff/ECCO huggingface dataset:
# Original solution
n = int(eval(input()))
a = [int(i) for i in input().split()]


#%%
# n, a = 4, [2, 10, 8, 40]


#%%


#%%

#%%
while len(a) >= 2:
    a.sort()

    for i in range(len(a) -1, 0, -1):
        a[i] = a[i] % a[0]
        if a[i] == 0:
            a.remove(a[i])
    


#%%
print((a[0]))

#%%



# Optimized solution
n = int(eval(input()))
a = [int(i) for i in input().split()]


def euclid_lcf(a, b):
    if b < a:
        a, b = b, a

    if b % a == 0:
        return a
    else:
        r = b % a
        return euclid_lcf(a, r)


com_factor = euclid_lcf(a[0], a[1])

if len(a) == 2:
    print(com_factor)
else:
    for i in range(2, len(a)):
        com_factor = euclid_lcf(com_factor, a[i])

    print(com_factor)
# Original solution
import sys
sys.setrecursionlimit(1000000)

def gcd(i,j):
  if i>j:
    i,j=j,i
  if j%i==0:
    return i
  return gcd(j-i,i)

n=int(eval(input()))
l=[int(i) for i in input().split()]
g=gcd(l[0],l[1])
for i in range(2,len(l)):
  g=gcd(g,l[i])
print(g)

# Optimized solution
import sys
sys.setrecursionlimit(1000000)

def gcd(i,j):
  if i>j:
    i,j=j,i
  if j%i==0:
    return i
  return gcd(j-i,i)

n=int(eval(input()))
l=[int(i) for i in input().split()]
l.sort()
g=gcd(l[0],l[1])
for i in range(2,len(l)):
  g=gcd(g,l[i])
print(g)
# Original solution
import itertools
import copy

def main():
    N = int(eval(input()))
    A = set(list(map(int, input().split())))

    com0 = None
    while True:
        com = list(itertools.combinations(A,2))
        if com0 == com:
            break
        com0 = copy.copy(com)
        for q in com:
            if q[0] != 0 and q[1] != 0:
                if q[0] > q[1]:
                    a1 = q[1]
                    a2 = q[0]
                else:
                    a1 = q[0]
                    a2 = q[1]
                a = a2 % a1
                if a == 1:
                    print((1))
                    return
                elif a == 0:  # a2はa1の倍数
                    if a2 in A:
                        A.remove(a2)
                else:
                    A.add(a)
        #print(A)
    print((min(A)))

main()


# Optimized solution
def gcm(a,b):
    while b != 0:
        a, b = b, a % b
    return a

def gcm_list(a):
    ans = a[0]
    l = len(a)
    for i in range(1, l):
        ans = gcm(ans, a[i])
    return ans

N = int(eval(input()))
A = list(map(int, input().split()))
print((gcm_list(A)))
# Original solution
N = int(eval(input()))
A = list(map(int, input().split()))
A.sort()

while A[-2] != 0:
    A[-1] -= A[-2] * (A[-1] // A[-2])
    A.sort()

print((A[-1]))

# Optimized solution
N = int(eval(input()))
A = list(map(int, input().split()))

while len(A) > 1:
    minA = min(A)
    tempA = []
    tempA.append(minA)
    for a in A:
        mod = a % minA
        if mod != 0:
            tempA.append(mod)
    A = tempA

print((A[0]))
# Original solution
N = int(eval(input()))
A = list(map(int, input().split()))

while len(A) > 1:
    minA = min(A)
    tempA = []
    tempA.append(minA)
    for a in A:
        mod = a % minA
        if mod != 0:
            tempA.append(mod)
    A = tempA

print((A[0]))

# Optimized solution
N = int(eval(input()))
A = set(map(int, input().split()))

while len(A) > 1:
    minA = min(A)
    tempA = set()
    tempA.add(minA)
    for a in A:
        mod = a % minA
        if mod != 0:
            tempA.add(mod)
    A = tempA

print((list(A)[0]))
# Original solution
N = int(eval(input()))
A = set(map(int, input().split()))

while len(A) > 1:
    minA = min(A)
    tempA = set()
    tempA.add(minA)
    for a in A:
        mod = a % minA
        if mod != 0:
            tempA.add(mod)
    A = tempA

print((list(A)[0]))

# Optimized solution
N = int(eval(input()))
A = list(map(int, input().split()))

while len(A) > 1:
    minA = min(A)
    tempA = []
    tempA.append(minA)
    for a in A:
        mod = a % minA
        if mod > 0:
            tempA.append(mod)
    A = tempA

print((A[0]))
# Original solution
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)

# Optimized solution
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)
# Original solution
import sys
n = int(eval(input()))
a = list(map(int, input().split()))
sys.setrecursionlimit(10 ** 5)


def cut(l):
    l.sort()
    nokori = [l[0]]
    for i in range(1, len(l)):
        b = l[i] % l[0]
        if b != 0:
            nokori.append(b)
    if len(nokori) != 1:
        return cut(nokori)
    return nokori[0]


print((cut(a)))


# Optimized solution
import sys

n = int(eval(input()))
al = list(map(int, input().split()))
sys.setrecursionlimit(10 ** 5)


def gcd(a, b):
    if b < a:
        a, b = b, a
    if b % a == 0:
        return a
    else:
        return gcd(a, b % a)


def gcdl(num, n):
    ans = num[0]
    for i in range(n):
        ans = gcd(ans, num[i])
    return ans


print((gcdl(al, n)))
# Original solution
N = int(eval(input()))
A = [int(_) for _ in input().split()]
m = min(A)
if m == 1:
    print(m)
else:
    while m > 0:
        m = min(A)
        for i in range(0,len(A)):
            if A[i] != m:
                A[i] = A[i]%m
        z = A.count(0)
        for j in range(z):
            A.remove(0)
        if A.count(1) >= 1:
            m = 1
            break
        else:
            if [_%min(A) for _ in A].count(0) == len(A):
                m = min(A)
                break
    print(m)

# Optimized solution
N = int(eval(input()))
A = [int(_) for _ in input().split()]
m = min(A)
while m > 0:
    for i in range(0,len(A)):
        if A[i] != m:
            A[i] = A[i]%m
    z = A.count(0)
    A = sorted(A)[z:]
    m = A[0]
    if m == 1:
        break
    else:
        if [_%m for _ in A] == [0]*len(A):
            break
print(m)
# Original solution
N = int(eval(input()))
A = list(map(int,input().split()))

def gcd(a,b):
    while b!=0:
        a,b=b,a%b
    return a

gcd_a = A[0]

for i in A:
    gcd_a = gcd(gcd_a,i)

print(gcd_a)

# Optimized solution
from math import gcd

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

g = A[0]

for i in A:
    g = gcd(g,i)

print(g)
# Original solution
from collections import defaultdict
from collections import deque
from collections import Counter
import itertools
import math

def readInt():
  return int(eval(input()))
def readInts():
  return list(map(int, input().split()))
def readChar():
  return eval(input())
def readChars():
  return input().split()

n = readInt()
a = list(set(readInts()))

if len(a)==1:
  print((a[0]))
  exit()

odd = []
even = []


from math import gcd


d = a[0]
for i in a:
  d = gcd(i,d)
print(d)

# Optimized solution
import math;eval(input());a=list(map(int,input().split()));d=a[0]
for i in a:d=math.gcd(i,d)
print(d)
# Original solution
n=int(eval(input()))
l=sorted(list(map(int,input().split())))
m=min(l)
l2=[]
l3=[]
for i in range(1,int(m**(1/2)+1)):
  if m%i==0:                   
    l2.append(i)
    if i!=m//i:
      l2.append(m//i)
for i in l2:
  b=True
  for j in l:
    if j%i==0:
      pass
    else:
      b=False
  if b:
    l3.append(i)
print((max(l3)))

# Optimized solution
def gcd(n,m):
  a=min(n,m)
  b=max(n,m)
  while a!=0:
    b,a=a,b%a
  return b
n=int(eval(input()))
l=list(map(int,input().split()))
ans=l[0]
for i in range(1,n):
  ans=gcd(ans,l[i])
print(ans)
# Original solution
N = int(eval(input()))
A = list(map(int, input().split()))

As = sorted(A)
As = [a%As[0] if a%As[0] != 0 else As[0] for a in As]
As = sorted(As)

def judge(tmp_one, tmp_two):
    flg = 1

    while flg:
        if tmp_two%tmp_one == 0:
            tmp_two = tmp_one
        else:
            tmp_two = tmp_two%tmp_one

        if tmp_one%tmp_two == 0:
            tmp_one = tmp_two
        else:
            tmp_one = tmp_one%tmp_two
        if tmp_one == tmp_two:
            flg = 0

    return tmp_one

tmp_one = As[0]
for i in range(1, N):
    if i == N - 1:
        tmp_two = As[i]
    elif As[i] != As[0]:
        tmp_two = As[i]
        break

ans = judge(tmp_one, tmp_two)
print(ans)

# Optimized solution
N = int(eval(input()))
A = list(map(int, input().split()))


def gcd(n, m):
    if n < m:
        temp = n
        n = m
        m = temp
    
    def ecd(n, m):
        if n % m == 0:
            return m
        else:
            temp = n % m
            a = ecd(m, temp)
        return a
           
    return ecd(n, m)

temp = gcd(A[0], A[1])
for i in range(0, N-1):
    temp = gcd(temp, A[i])
    
print(temp)
# Original solution
n = int(eval(input()))
a = list(map(int,input().split()))
while len(a)!=1:
    a = sorted(a)
    a = [i%min(a) for i in a[1:]]+[min(a)]
    a = [i for i in a if i!=0]
print((min(a)))

# Optimized solution
n = int(eval(input()))
a = list(map(int,input().split()))
def gcd(x,y):
    if x<y:
        x,y = y,x
    if y==0:
        return x
    if x%y==0:
        return y
    else:
        return gcd(y,x%y)
ans = a[0]
for i in a:
    ans = gcd(ans,i)
print(ans)
# Original solution
def gcd(a,b):
    if a < b:
        return gcd(b,a)
    else:
        if a%b == 0:
            return b
        else:
            return gcd(b,a%b)
N = int(eval(input()))
src = sorted(list(map(int,input().split())))
ans = src[0]
for i in range(1,N)[::-1]:
    ans = gcd(ans,src[i])
print(ans)

# Optimized solution
def Gcd(a,b):
    if a < b:
        return Gcd(b,a)
    else:
        if a%b:
            return Gcd(b,a%b)
        else:
            return b

N = int(eval(input()))
arr = list(map(int,input().split()))
gcd = arr[0]
for i in arr:
    gcd = Gcd(gcd,i)
print(gcd)
# Original solution
def gcd(x,y):
  if y==0:
    return x
  else:
    return gcd(y,x%y)

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

g=a[0]
for aa in a:
  g=gcd(g,aa)
print(g)


# Optimized solution
def gcd(x, y):
    if y == 0: return x
    return gcd(y, x % y)


N = int(eval(input()))
a = list(map(int, input().split()))

g = a[0]
for aa in a:
    g = gcd(g, aa)
print(g)
# Original solution
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)

# Optimized solution
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)
# Original solution
from math import gcd

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


for i in range(n-1):
  a[i+1] = gcd(a[i], a[i+1])
  
print((a[n-1]))

# Optimized solution
from math import gcd
n=int(eval(input()))
a=list(map(int,input().split()))
res=a[0]
for i in range(1,n):
  res=gcd(res,a[i])
print(res)
# Original solution
import math

def process(number_list):
    left, point = number_list[0], number_list[-2]
    if left == 1:
        print((1))
        return 0
    yojo = number_list[-1] % left
    point -= yojo
    right = left * (math.ceil(point / left) - 1) + yojo
    if right == 0:
        number_list.pop(-1)
        if len(number_list) == 1:
            print((number_list[0]))
            return 0
    else:
        number_list[-1] = right
        number_list.sort()
    return number_list

def main():
    num = int(eval(input()))
    number_list = list(map(int, input().split()))
    number_list.sort()
    while 1:
        number_list = process(number_list)
        if number_list == 0:
            break


if __name__ == '__main__':
    main()

# Optimized solution
import math

def process(number_list):
    left, point = number_list[0], number_list[-2]
    if left == 1:
        print((1))
        return 0
    right = number_list[-1] % left
    number_list.pop(-1)
    if right == 0:
        if len(number_list) == 1:
            print((number_list[0]))
            return 0
    else:
        number_list.insert(0, right)
    return number_list

def main():
    num = int(eval(input()))
    number_list = list(map(int, input().split()))
    number_list.sort()
    while 1:
        number_list = process(number_list)
        if number_list == 0:
            break


if __name__ == '__main__':
    main()
# Original solution
#!usr/bin/env python3
from collections import defaultdict
import math
import bisect
import random
def LI(): return list(map(int, input().split()))
def II(): return int(eval(input()))
def LS(): return input().split()
def S(): return list(eval(input()))
def IIR(n): return [II() for i in range(n)]
def LIR(n): return [LI() for i in range(n)]
def SR(n): return [S() for i in range(n)]
mod = 1000000007

#A

#B

#C
def gcd(a,b):
    if a == 0:
        return b
    return gcd(b%a,a)
n = II()
a = LI()
ans = a[0]
for i in range(1,n):
    ans = gcd(ans,a[i])
print(ans)
#D

#E

#F

#G

#H

#I

#J

#K

#L

#M

#N

#O

#P

#Q

#R

#S

#T


# Optimized solution
#!usr/bin/env python3
from collections import defaultdict
from collections import deque
from heapq import heappush, heappop
import sys
import math
import bisect
import random
def LI(): return list(map(int, sys.stdin.readline().split()))
def I(): return int(sys.stdin.readline())
def LS():return list(map(list, sys.stdin.readline().split()))
def S(): return list(sys.stdin.readline())[:-1]
def IR(n):
    l = [None for i in range(n)]
    for i in range(n):l[i] = I()
    return l
def LIR(n):
    l = [None for i in range(n)]
    for i in range(n):l[i] = LI()
    return l
def SR(n):
    l = [None for i in range(n)]
    for i in range(n):l[i] = S()
    return l
def LSR(n):
    l = [None for i in range(n)]
    for i in range(n):l[i] = SR()
    return l
sys.setrecursionlimit(1000000)
mod = 1000000007

#A
def A():
    a,b = LI()
    if b%a == 0:
        print((a+b))
    else:
        print((b-a))
    return

#B
def B():
    n,m = LI()
    d = defaultdict(int)
    for i in range(n):
        l = LI()
        for j in range(1,len(l)):
            d[l[j]] += 1
    ans = 0
    for i in list(d.values()):
        if i == n:
            ans += 1
    print(ans)
    return

#C
def C():
    def gcd(a,b):
        if a == 0:
            return b
        return gcd(b%a,a)
    n = I()
    a = LI()
    g = a[0]
    for i in range(1,n):
        g = gcd(g,a[i])
    print(g)
    return

#D
def D():
    return

#E
def E():
    return

#F
def F():
    return

#G
def G():
    return

#H
def H():
    return

#Solve
if __name__ == "__main__":
    C()
# Original solution
def gcd(a, b):
  while b > 0:
    a, b = b, a%b
  return a

n = int(eval(input()))
enemy = list(set(map(int,input().split())))
if len(enemy)==1:
    print((enemy[0]))
else:
    enemy.sort()
    min_n = 10**10
    for i in range(len(enemy)-1):
        min_n = min(min_n,gcd(enemy[i],enemy[i+1]))
    print(min_n)

# Optimized solution
def gcd(x,y):
    if x%y==0: return y
    else: return gcd(y,x%y)
n = int(eval(input()))
a = list(map(int,input().split()))
a.sort()
ans = a[0]
for i in range(1,n):
    ans = min(ans,gcd(ans,a[i]))
print(ans)
# Original solution
n = int(eval(input()))
a = list(map(int,input().split()))
a.sort()
gcd = a[-1]
def Euclid(n1,n2):
    if n1 % n2 == 0:
        return n2
    return Euclid(n2,n1%n2)
for i in range(n-1):
    gcd = Euclid(gcd,a[(-1)*(i+2)])
print(gcd)


# Optimized solution
n = int(eval(input()))
a = list(map(int,input().split()))
gcd = a[-1]
def Euclid(n1,n2):
    if n1 % n2 == 0:
        return n2
    return Euclid(n2,n1%n2)
for i in range(n-1):
    gcd = Euclid(gcd,a[(-1)*(i+2)])
print(gcd)
# Original solution
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import bisect

def solve():
    n = int(eval(input()))
    al = [int(i) for i in input().split()]
    al.sort()
    while len(al) > 1:
        p = al[-1] % sum(al[:-1])
        q = al[-1]
        al = al[:-1]
        if p == 0:
            continue
        if p == q:
            q -= al[-1]
            if q <= 0:
                continue
            p = q
        bisect.insort(al, p)
    print((al[0]))

if __name__=="__main__":
    solve()


# Optimized solution
#!/usr/bin/env python
# -*- coding: utf-8 -*-

def gcd(a, b):
    if a < b:
        a,b = b,a
    while b > 0:
        r = a % b
        a,b = b,r
    return a

def arrgcd(a):
    alen = len(a)
    if alen == 3:
        return gcd(a[0], gcd(a[1], a[2]))
    elif alen == 2:
        return gcd(a[0], a[1])
    elif alen == 1:
        return a[0] # 最初から1つ
    elif alen == 0:
        return 0
    else:
        return gcd(arrgcd(a[:alen//2]), arrgcd(a[alen//2:]))

def solve():
    n = int(eval(input()))
    al = [int(i) for i in input().split()]
    print((arrgcd(al)))

if __name__=="__main__":
    solve()
# Original solution
# coding: utf-8
import sys
import collections

N = int(sys.stdin.readline())

monster = [int(a) for a in sys.stdin.readline().strip().split()]
monster.sort()

while len(monster)>1:
    monster[1] %= monster[0]
    if monster[1] == 0:
        monster.pop(1)
    monster.sort()


print((monster[0]))

# Optimized solution
# coding: utf-8
import sys
import collections

N = int(sys.stdin.readline())

monster = [int(a) for a in sys.stdin.readline().strip().split()]
monster.sort()

while len(monster)>1:
    for i in range(1,len(monster)):
        monster[i] %= monster[0]
    monster.sort()
    while monster[0]==0:
        monster.pop(0)
    


print((monster[0]))
# Original solution
N=int(eval(input()))
L=list(map(int,input().split()))



def f(l, s):
    return s if l % s == 0 else f(s, l % s)
    
z = f(max(L), min(L))

for i in L:
    z=f(i,z)

for i in range(1,10**6):
    if max(L)>=i and i%z==0:
        print(i)
        exit()
print(z)

# Optimized solution
N=int(eval(input()))
L=list(map(int,input().split()))



def f(l, s):
    return s if l % s == 0 else f(s, l % s)
    
z = f(max(L), min(L))

for i in L:
    z=f(i,z)
ans=10000000000
for i in range(len(L)):
    if L[i]%z==0:
        pass
    elif L[i]%z<ans:
        ans=L[i]%z

if ans==10000000000:
    print(z)
else:
    print(ans)
# Original solution
n = int(eval(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]))


# Optimized solution
n = int(eval(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]))
# Original solution
n = int(eval(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]))


# Optimized solution
n = int(eval(input()))
a = list(map(int, input().split()))

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]))
# Original solution
N = int(eval(input()))
A = list(map(int, input().split()))
x=0
key = min(A)
while x==0:
    for i in range(N):
        if int(A[i]%key)==0:
            A[i]=key
        else:
            A[i]=A[i]%key
            
    if min(A)==key:
        print(key)
        break
    else:
        key = min(A)

# Optimized solution
N = int(eval(input()))
List = list(map(int, input().split()))

while len(List)!=1:
    m = min(List)
    List = [e%m for e in List]
    List = [e for e in List if e>0]
    List.append(m)
    
print(m)
# Original solution
n = int(eval(input()))
monster = set(map(int,input().split()))
monster = sorted(list(monster))
if len(monster)==1:
  print((monster[0]))
  exit()

while True:
  tmp = int(monster[-1]/monster[-2])
  monster[-1]-=monster[-2]*tmp
  monster = sorted(monster)
  if monster[-2]==0:
    print((monster[-1]))
    exit()

# Optimized solution
def gcd(a, b):
  while b:
    a, b = b, a % b
 
  return a

n = int(eval(input()))
monster = sorted(list(map(int,input().split())))
ans = []
for i in range(n-1):
  g = gcd(monster[i], monster[i+1])
  ans.append(g)
print((min(ans)))
# Original solution
def gcd(x,y):
    while y>0:
        x,y = y,x%y
    return x
N = int(eval(input()))
A = list(map(int,input().split()))
x = A[0]
for i in range(1,N):
    x = gcd(x,A[i])
print(x)

# Optimized solution
def gcd(x,y):
    while y>0:
        x,y = y,x%y
    return x
N = int(eval(input()))
A = list(map(int,input().split()))
cmin = A[0]
for i in range(1,N):
    cmin = gcd(cmin,A[i])
print(cmin)
# Original solution
n = int(eval(input()))
a = list(map(int,input().split()))

a.sort()
for i in range(1,n):
    while a[i]%a[0] != 0:
        a[0],a[i] = a[i]%a[0],a[0]
else:
    ans = a[0]

print(ans)

# Optimized solution
n = int(eval(input()))
a = list(map(int,input().split()))

for i in range(1,n):
    while a[i]%a[0] != 0:
        a[0],a[i] = a[i]%a[0],a[0]
else:
    ans = a[0]

print(ans)
# Original solution
N = int(eval(input()))
A = list(map(int, input().split()))

# A内の整数値を用いて作られる最小の整数を求めよ、という問題


def gcd(a, b):
    """
    自然数a, b の最大公約数を求める
    """
    if b == 0:
        return a
    else:
        return gcd(b, a % b)


ans = float('inf')
for i in range(N):
    for j in range(i, N):
        ans = min(ans, gcd(A[i], A[j]))


print(ans)

# Optimized solution
N = int(eval(input()))
A = list(map(int, input().split()))

# A内の整数値を用いて作られる最小の整数を求めよ、という問題


def gcd(a, b):
    """
    自然数a, b の最大公約数を求める
    """
    if b == 0:
        return a
    else:
        return gcd(b, a % b)


ans = gcd(A[0], A[1])
for i in range(1, N):
    ans = min(ans, gcd(ans, A[i]))


print(ans)
# Original solution

def gcd(a, b):
    lower = min(a, b)
    bigger = max(a, b)

    for i in range(lower, 0, -1):
        if a%i==0 and b%i==0:
            return i


def solve():
    N = int(eval(input()))
    A = [int(x) for x in input().split(" ")]

    d = 10**9
    for i in range(1, N):
        d = min(gcd(A[0], A[i]), d)

    print(d)


if __name__ == "__main__":
    solve()

# Optimized solution
def gcd(a, b):
    """ 最大公約数。aはbより大きいこと """
    if b == 0:
        return a
    else:
        return gcd(b, a%b)


def solve():
    N = int(eval(input()))
    A = [int(x) for x in input().split(" ")]

    A.sort(reverse=True)
    ans = A[0]
    for i in range(1, N):
        ans = gcd(ans, A[i])

    print(ans)


if __name__ == "__main__":
    solve()
# Original solution
n = int(eval(input()))
mon = list(map(int, input().split()))
g = min(mon)
div = []
for i in range(1, g + 1):
  if (g % i == 0):
    div.append(i)
    div.append(g // i)
  if (i * i > g):
    break
div.sort(reverse=True)
for d in div:
  mod = []
  for m in mon:
    mod.append(m % d)
  if (list(set(mod)) == [0]):
    print(d)
    break

# Optimized solution
def gcd(x, y):
  while(y):
    x, y = y, x % y
  return x
n = int(eval(input()))
mon = list(map(int, input().split()))
g = mon[0]
for i in range(1, n):
  g = gcd(g, mon[i])
print(g)
# Original solution
N = int(eval(input()))
A = list(map(int, input().split()))
sort = sorted(A)
amari = []
while len(amari) != 1:
  amari.clear()
  if 0 in sort: sort.remove(0)
  for item in sort:
    if item%sort[0] not in amari:
      amari.append(item%sort[0])
  last_sort0 = sort[0]
  sort = sorted(amari[:])
  sort.append(last_sort0)

print((last_sort0-amari[0]))

# Optimized solution
N = int(eval(input()))
A = list(map(int, input().split()))
sort = sorted(A)
# amari = []
# while len(amari) != 1:
#   amari.clear()
#   if 0 in sort: sort.remove(0)
#   for item in sort:
#     if item%sort[0] not in amari:
#       amari.append(item%sort[0])
#   last_sort0 = sort[0]
#   sort = sorted(amari[:])
#   sort.append(last_sort0)

# print(last_sort0-amari[0])

while len(sort) != 1:
  for i in range(1,len(sort)):
    sort[i] = sort[i]%sort[0]
  sort = [j for j in sorted(sort) if j != 0]

print((sort[0]))