from heapq import heapify, heappush, heappop



def main():

    N = int(eval(input()))

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

    heapify(A)

    while len(A) > 1:

        m = heappop(A)

        A = [a % m for a in A if a % m != 0]

        A.append((m))



    print(m)





if __name__ == "__main__":

    main()
def main():

    N = int(eval(input()))

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

    while len(A) > 1:

        m = min(A)

        A = [a % m for a in A if a % m != 0]

        A.append((m))



    print(m)





if __name__ == "__main__":

    main()
from heapq import heapify, heappush, heappop


def main():
    N = int(eval(input()))
    A = list(map(int, input().split()))
    heapify(A)
    while len(A) > 1:
        m = heappop(A)
        A = [a % m for a in A if a % m != 0]
        A.append((m))
    print(m)


if __name__ == "__main__":
    main()

def main():
    N = int(eval(input()))
    A = list(map(int, input().split()))
    while len(A) > 1:
        m = min(A)
        A = [a % m for a in A if a % m != 0]
        A.append((m))
    print(m)


if __name__ == "__main__":
    main()

-from heapq import heapify, heappush, heappop - - -    heapify(A) -        m = heappop(A) +        m = min(A)