def main():
    N = int(input())
    A = list(map(int, input().split()))

    while True:
        A.sort()
        mod_max = 0
        for i in range(len(A)-1, 0, -1):
            tmp = A[i] % A[0]
            if tmp == 0:
                A.pop(i)
            else:
                A[i] = tmp
            if mod_max < tmp:
                mod_max = tmp
        if mod_max == 0:
            print(A[0])
            exit()
        elif mod_max == 1:
            print(1)
            exit()


if __name__ == "__main__":
    main() def main():
    N = int(input())
    A = list(map(int, input().split()))

    while True:
        A.sort()
        mod_max = 0
        for i in range(len(A)-1, 0, -1):
            tmp = A[i] % A[0]
            if tmp == 0:
                A.pop(i)
            else:
                A[i] = tmp
            if mod_max < tmp:
                mod_max = tmp
        if mod_max == 0:
            print(A[0])
            exit()
        elif mod_max == 1:
            print(1)
            exit() 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 while True:
        A.sort()
        mod_max = 0
        for i in range(len(A)-1, 0, -1):
            tmp = A[i] % A[0]
            if tmp == 0:
                A.pop(i)
            else:
                A[i] = tmp
            if mod_max < tmp:
                mod_max = tmp
        if mod_max == 0:
            print(A[0])
            exit()
        elif mod_max == 1:
            print(1)
            exit() True A.sort() A.sort A sort mod_max = 0 mod_max 0 for i in range(len(A)-1, 0, -1):
            tmp = A[i] % A[0]
            if tmp == 0:
                A.pop(i)
            else:
                A[i] = tmp
            if mod_max < tmp:
                mod_max = tmp
         i range(len(A)-1, 0, -1) range len(A)-1 len(A) len A 1 0 -1 tmp = A[i] % A[0] tmp A[i] % A[0] A[i] A i A[0] A 0 if tmp == 0:
                A.pop(i)
            else:
                A[i] = tmp
             tmp == 0 tmp 0 A.pop(i) A.pop A pop i A[i] = tmp A[i] A i tmp if mod_max < tmp:
                mod_max = tmp
         mod_max < tmp mod_max tmp mod_max = tmp mod_max tmp if mod_max == 0:
            print(A[0])
            exit()
        elif mod_max == 1:
            print(1)
            exit() mod_max == 0 mod_max 0 print(A[0]) print A[0] A 0 exit() exit elif mod_max == 1:
            print(1)
            exit() mod_max == 1 mod_max 1 print(1) print 1 exit() exit if __name__ == "__main__":
    main() __name__ == "__main__" __name__ "__main__" main() main def main():
    N = int(input())
    A = list(map(int, input().split()))

    while True:
        A.sort()
        mod_max = 0
        for i in range(len(A)-1, 0, -1):
            tmp = A[i] % A[0]
            if tmp == 0:
                A.pop(i)
            else:
                A[i] = tmp
            if mod_max < tmp:
                mod_max = tmp
        if mod_max == 0:
            print(A[0])
            exit()
        elif mod_max == 1:
            print(1)
            exit() def main():
    N = int(input())
    A = list(map(int, input().split()))

    while True:
        A.sort()
        mod_max = 0
        for i in range(len(A)-1, 0, -1):
            tmp = A[i] % A[0]
            if tmp == 0:
                A.pop(i)
            else:
                A[i] = tmp
            if mod_max < tmp:
                mod_max = tmp
        if mod_max == 0:
            print(A[0])
            exit()
        elif mod_max == 1:
            print(1)
            exit() main
def main():
    N = int(input())
    A = list(map(int, input().split()))

    while True:
        A.sort()
        mod_max = 0
        for i in range(len(A)-1, 0, -1):
            tmp = A[i] % A[0]
            if tmp == 0:
                A.pop(i)
            else:
                A[i] = tmp
            if mod_max < tmp:
                mod_max = tmp
        if mod_max == 0:
            print(A[0])
            exit()
        elif mod_max == 1:
            print(1)
            exit()


if __name__ == "__main__":
    main()
