#dpでできないかな？

import sys

input = sys.stdin.readline

sys.setrecursionlimit(10**7)

from collections import Counter, deque

from collections import defaultdict

from itertools import combinations, permutations, accumulate, groupby, product

from bisect import bisect_left,bisect_right

from heapq import heapify, heappop, heappush

from math import floor, ceil,pi

from operator import itemgetter

def I(): return int(eval(input()))

def MI(): return list(map(int, input().split()))

def LI(): return list(map(int, input().split()))

def LI2(): return [int(eval(input())) for i in range(n)]

def MXI(): return [[LI()]for i in range(n)]

def SI(): return input().rstrip()

def printns(x): print(('\n'.join(x)))

def printni(x): print(('\n'.join(list(map(str,x)))))

inf = 10**17

mod = 10**9 + 7



n=I()

lis=LI()

lis=sorted(lis)

#print(lis)



for i in range(1,n):

    lis[i]=lis[i]%lis[0]

lis.append(0)

lis=sorted(list(set(lis)))

    

while len(lis)>2:

    for i in range(2,len(lis)):

        lis[i]=lis[i]%lis[1]

    lis.append(0)

    lis=sorted(list(set(lis)))

#print(lis)

print((lis[-1]))

#print(lis[0])
#float型を許すな

#numpyはpythonで

import sys

input = sys.stdin.readline

sys.setrecursionlimit(10**7)

from collections import Counter, deque

from collections import defaultdict

from itertools import combinations, permutations, accumulate, groupby, product

from bisect import bisect_left,bisect_right

from heapq import heapify, heappop, heappush

from math import floor, ceil,pi,factorial

from operator import itemgetter

def I(): return int(eval(input()))

def MI(): return list(map(int, input().split()))

def LI(): return list(map(int, input().split()))

def LI2(): return [int(eval(input())) for i in range(n)]

def MXI(): return [[LI()]for i in range(n)]

def SI(): return input().rstrip()

def printns(x): print(('\n'.join(x)))

def printni(x): print(('\n'.join(list(map(str,x)))))

inf = 10**17

mod = 10**9 + 7



def gcd(a, b):

    while b:

        a, b = b, a % b

    return a



n=I()

lis=LI()

p=lis[0]

for i in range(n-1):

    p=gcd(p,lis[i+1])

print(p)

    



    
# dpでできないかな？
import sys

input = sys.stdin.readline
sys.setrecursionlimit(10**7)
from collections import Counter, deque
from collections import defaultdict
from itertools import combinations, permutations, accumulate, groupby, product
from bisect import bisect_left, bisect_right
from heapq import heapify, heappop, heappush
from math import floor, ceil, pi
from operator import itemgetter


def I():
    return int(eval(input()))


def MI():
    return list(map(int, input().split()))


def LI():
    return list(map(int, input().split()))


def LI2():
    return [int(eval(input())) for i in range(n)]


def MXI():
    return [[LI()] for i in range(n)]


def SI():
    return input().rstrip()


def printns(x):
    print(("\n".join(x)))


def printni(x):
    print(("\n".join(list(map(str, x)))))


inf = 10**17
mod = 10**9 + 7
n = I()
lis = LI()
lis = sorted(lis)
# print(lis)
for i in range(1, n):
    lis[i] = lis[i] % lis[0]
lis.append(0)
lis = sorted(list(set(lis)))
while len(lis) > 2:
    for i in range(2, len(lis)):
        lis[i] = lis[i] % lis[1]
    lis.append(0)
    lis = sorted(list(set(lis)))
# print(lis)
print((lis[-1]))
# print(lis[0])

# float型を許すな
# numpyはpythonで
import sys

input = sys.stdin.readline
sys.setrecursionlimit(10**7)
from collections import Counter, deque
from collections import defaultdict
from itertools import combinations, permutations, accumulate, groupby, product
from bisect import bisect_left, bisect_right
from heapq import heapify, heappop, heappush
from math import floor, ceil, pi, factorial
from operator import itemgetter


def I():
    return int(eval(input()))


def MI():
    return list(map(int, input().split()))


def LI():
    return list(map(int, input().split()))


def LI2():
    return [int(eval(input())) for i in range(n)]


def MXI():
    return [[LI()] for i in range(n)]


def SI():
    return input().rstrip()


def printns(x):
    print(("\n".join(x)))


def printni(x):
    print(("\n".join(list(map(str, x)))))


inf = 10**17
mod = 10**9 + 7


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


n = I()
lis = LI()
p = lis[0]
for i in range(n - 1):
    p = gcd(p, lis[i + 1])
print(p)

-# dpでできないかな？ +# float型を許すな +# numpyはpythonで -from math import floor, ceil, pi +from math import floor, ceil, pi, factorial + + +def gcd(a, b): +    while b: +        a, b = b, a % b +    return a + + -lis = sorted(lis) -# print(lis) -for i in range(1, n): -    lis[i] = lis[i] % lis[0] -lis.append(0) -lis = sorted(list(set(lis))) -while len(lis) > 2: -    for i in range(2, len(lis)): -        lis[i] = lis[i] % lis[1] -    lis.append(0) -    lis = sorted(list(set(lis))) -# print(lis) -print((lis[-1])) -# print(lis[0]) +p = lis[0] +for i in range(n - 1): +    p = gcd(p, lis[i + 1]) +print(p)