import functools
def euclid(a, b):
    if b == 0:
        return a
    else:
        return euclid(b, a%b)

def gcd(nums):
    return functools.reduce(euclid, nums)



n=int(input())
a=[int(i) for i in input().split()]

print(gcd(a)) import functools functools def euclid(a, b):
    if b == 0:
        return a
    else:
        return euclid(b, a%b) euclid if b == 0:
        return a
    else:
        return euclid(b, a%b) b == 0 b 0 return a a return euclid(b, a%b) euclid(b, a%b) euclid b a%b a b a a b b def gcd(nums):
    return functools.reduce(euclid, nums) gcd return functools.reduce(euclid, nums) functools.reduce(euclid, nums) functools.reduce functools reduce euclid nums nums nums n=int(input()) n int(input()) int input() input int(i) for i in input().split() for i in input().split() i input().split() ().split () input split for i in input().split() int(i) int i a=[int(i) for i in input().split()] a [int(i) for i in input().split()] print(gcd(a)) print gcd(a) gcd a n=int(input()) int(input()) n def gcd(nums):
    return functools.reduce(euclid, nums) def gcd(nums):
    return functools.reduce(euclid, nums) gcd a=[int(i) for i in input().split()] [int(i) for i in input().split()] a def euclid(a, b):
    if b == 0:
        return a
    else:
        return euclid(b, a%b) def euclid(a, b):
    if b == 0:
        return a
    else:
        return euclid(b, a%b) euclid
import functools
def euclid(a, b):
    if b == 0:
        return a
    else:
        return euclid(b, a%b)

def gcd(nums):
    return functools.reduce(euclid, nums)



n=int(input())
a=[int(i) for i in input().split()]

print(gcd(a))
