from functools import reduce





def gcd(a, b):

    if b > a:

        a, b = b, a

    dp = [a, b]

    for i, v in enumerate(dp, start=2):

        dp.append(dp[i - 2] % dp[i - 1])

        if dp[i] == 0:

            break

    return dp[i - 1]





N = int(eval(input()))

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

print((reduce(gcd, a)))

import math



n = int(eval(input()))

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

ans = 0

for i in a:

    ans = math.gcd(ans, i)



print(ans)

from functools import reduce


def gcd(a, b):
    if b > a:
        a, b = b, a
    dp = [a, b]
    for i, v in enumerate(dp, start=2):
        dp.append(dp[i - 2] % dp[i - 1])
        if dp[i] == 0:
            break
    return dp[i - 1]


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

import math

n = int(eval(input()))
a = list(map(int, input().split()))
ans = 0
for i in a:
    ans = math.gcd(ans, i)
print(ans)

-from functools import reduce +import math - -def gcd(a, b): -    if b > a: -        a, b = b, a -    dp = [a, b] -    for i, v in enumerate(dp, start=2): -        dp.append(dp[i - 2] % dp[i - 1]) -        if dp[i] == 0: -            break -    return dp[i - 1] - - -N = int(eval(input())) +n = int(eval(input())) -print((reduce(gcd, a))) +ans = 0 +for i in a: +    ans = math.gcd(ans, i) +print(ans)