import sys
input = sys.stdin.readline
def gdc(p, q):
    if q == 0:
        return p
    return gdc(q, p%q)

def main():
    N = int(input())
    A = list(map(int, input().split()))
    if N == 1:
        print(A[0])
        return
    res = A[0]
    for i in range(1,N):
        res = gdc(res, A[i])
    print(res)

if __name__ == '__main__':
    main() import sys sys input = sys.stdin.readline input sys.stdin.readline sys.stdin sys stdin readline def gdc(p, q):
    if q == 0:
        return p
    return gdc(q, p%q) gdc if q == 0:
        return p
     q == 0 q 0 return p p return gdc(q, p%q) gdc(q, p%q) gdc q p%q p q p p q q def main():
    N = int(input())
    A = list(map(int, input().split()))
    if N == 1:
        print(A[0])
        return
    res = A[0]
    for i in range(1,N):
        res = gdc(res, A[i])
    print(res) main 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 if N == 1:
        print(A[0])
        return
     N == 1 N 1 print(A[0]) print A[0] A 0 return res = A[0] res A[0] A 0 for i in range(1,N):
        res = gdc(res, A[i])
     i range(1,N) range 1 N res = gdc(res, A[i]) res gdc(res, A[i]) gdc res A[i] A i print(res) print res if __name__ == '__main__':
    main() __name__ == '__main__' __name__ '__main__' main() main input = sys.stdin.readline sys.stdin.readline input def main():
    N = int(input())
    A = list(map(int, input().split()))
    if N == 1:
        print(A[0])
        return
    res = A[0]
    for i in range(1,N):
        res = gdc(res, A[i])
    print(res) def main():
    N = int(input())
    A = list(map(int, input().split()))
    if N == 1:
        print(A[0])
        return
    res = A[0]
    for i in range(1,N):
        res = gdc(res, A[i])
    print(res) main def gdc(p, q):
    if q == 0:
        return p
    return gdc(q, p%q) def gdc(p, q):
    if q == 0:
        return p
    return gdc(q, p%q) gdc
import sys
input = sys.stdin.readline
def gdc(p, q):
    if q == 0:
        return p
    return gdc(q, p%q)

def main():
    N = int(input())
    A = list(map(int, input().split()))
    if N == 1:
        print(A[0])
        return
    res = A[0]
    for i in range(1,N):
        res = gdc(res, A[i])
    print(res)

if __name__ == '__main__':
    main()