import sys

import fractions



sys.setrecursionlimit(10**6)

def input(): return sys.stdin.readline().strip()

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

def LIST(): return [int(x) for x in input().split()]

MOD = 10**9 + 7



N = INT()



A = LIST()



def gcd_all(n):

    if len(n) == 1:

        return n[0]



    tail = n.pop(-1)

    return fractions.gcd(tail, gcd_all(n))



print((gcd_all(A)))

import sys, fractions

sys.setrecursionlimit(5 * 10**5)

input = sys.stdin.readline



N = int(eval(input()))



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



ans = A[0]



for i in range(1, N):

    ans = fractions.gcd(ans, A[i])



print(ans)

import sys
import fractions

sys.setrecursionlimit(10**6)


def input():
    return sys.stdin.readline().strip()


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


def LIST():
    return [int(x) for x in input().split()]


MOD = 10**9 + 7
N = INT()
A = LIST()


def gcd_all(n):
    if len(n) == 1:
        return n[0]
    tail = n.pop(-1)
    return fractions.gcd(tail, gcd_all(n))


print((gcd_all(A)))

import sys, fractions

sys.setrecursionlimit(5 * 10**5)
input = sys.stdin.readline
N = int(eval(input()))
A = list(map(int, input().split()))
ans = A[0]
for i in range(1, N):
    ans = fractions.gcd(ans, A[i])
print(ans)

-import sys -import fractions +import sys, fractions -sys.setrecursionlimit(10**6) - - -def input(): -    return sys.stdin.readline().strip() - - -def INT(): -    return int(eval(input())) - - -def LIST(): -    return [int(x) for x in input().split()] - - -MOD = 10**9 + 7 -N = INT() -A = LIST() - - -def gcd_all(n): -    if len(n) == 1: -        return n[0] -    tail = n.pop(-1) -    return fractions.gcd(tail, gcd_all(n)) - - -print((gcd_all(A))) +sys.setrecursionlimit(5 * 10**5) +input = sys.stdin.readline +N = int(eval(input())) +A = list(map(int, input().split())) +ans = A[0] +for i in range(1, N): +    ans = fractions.gcd(ans, A[i]) +print(ans)