# なんかまともに考えるとわからん
# テキトーに問題文読まずサンプルだけ眺めるとgcdになる

n = int(input())
a = list(map(int, input().split()))
ans = a[0]


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


for i in range(1, n):
    ans = gcd(ans, a[i])
print(ans) n = int(input()) n int(input()) int input() input a = list(map(int, input().split())) a list(map(int, input().split())) list map(int, input().split()) map int input().split() ().split () input split ans = a[0] ans a[0] a 0 def gcd(a, b):
    if a > b:
        return gcd(b, a)
    while a > 0:
        a, b = b % a, a
    return b gcd if a > b:
        return gcd(b, a)
     a > b a b return gcd(b, a) gcd(b, a) gcd b a while a > 0:
        a, b = b % a, a
     a > 0 a 0 a, b = b % a, a a b % a b a b a return b b a a b b for i in range(1, n):
    ans = gcd(ans, a[i]) i range(1, n) range 1 n ans = gcd(ans, a[i]) ans gcd(ans, a[i]) gcd ans a[i] a i print(ans) print ans n = int(input()) int(input()) n ans = gcd(ans, a[i]) gcd(ans, a[i]) ans def gcd(a, b):
    if a > b:
        return gcd(b, a)
    while a > 0:
        a, b = b % a, a
    return b def gcd(a, b):
    if a > b:
        return gcd(b, a)
    while a > 0:
        a, b = b % a, a
    return b gcd a = list(map(int, input().split())) list(map(int, input().split())) a ans = a[0] a[0] ans
# なんかまともに考えるとわからん
# テキトーに問題文読まずサンプルだけ眺めるとgcdになる

n = int(input())
a = list(map(int, input().split()))
ans = a[0]


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


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