N = int(eval(input()))

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

A.sort()

count =0

while(len(A)!=1):

    tmp_min_A = min(A)

    for i in range(1,len(A)):

        A[i] = A[i] % tmp_min_A

        if A[i] == 0:

            count +=1

    A.sort()

    for i in range(count):

        A.remove(0)

    count = 0

    

  

print((A[0]))
import numpy as np

def main():

    n = int(eval(input()))

    a = [int(i) for i in input().split()]

    print((np.gcd.reduce(a)))

main()
N = int(eval(input()))
A = list(map(int, input().split()))
A.sort()
count = 0
while len(A) != 1:
    tmp_min_A = min(A)
    for i in range(1, len(A)):
        A[i] = A[i] % tmp_min_A
        if A[i] == 0:
            count += 1
    A.sort()
    for i in range(count):
        A.remove(0)
    count = 0
print((A[0]))

import numpy as np


def main():
    n = int(eval(input()))
    a = [int(i) for i in input().split()]
    print((np.gcd.reduce(a)))


main()

-N = int(eval(input())) -A = list(map(int, input().split())) -A.sort() -count = 0 -while len(A) != 1: -    tmp_min_A = min(A) -    for i in range(1, len(A)): -        A[i] = A[i] % tmp_min_A -        if A[i] == 0: -            count += 1 -    A.sort() -    for i in range(count): -        A.remove(0) -    count = 0 -print((A[0])) +import numpy as np + + +def main(): +    n = int(eval(input())) +    a = [int(i) for i in input().split()] +    print((np.gcd.reduce(a))) + + +main()