def main():
    N = int(input())
    A = list(map(int, input().split()))
    A.sort()
    before = A
    after = []
    for _ in range(pow(10, 9)):
        x = before[0]
        if len(before) == 1:
            print(x)
            return
        after.append(x)
        for i in range(1, len(before)):
            y = before[i]%x
            if y != 0:
                after.append(y)
        after.sort()
        before = after
        after = []

if __name__ == "__main__":
    main() def main():
    N = int(input())
    A = list(map(int, input().split()))
    A.sort()
    before = A
    after = []
    for _ in range(pow(10, 9)):
        x = before[0]
        if len(before) == 1:
            print(x)
            return
        after.append(x)
        for i in range(1, len(before)):
            y = before[i]%x
            if y != 0:
                after.append(y)
        after.sort()
        before = after
        after = [] 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 A.sort() A.sort A sort before = A before A after = [] after [] for _ in range(pow(10, 9)):
        x = before[0]
        if len(before) == 1:
            print(x)
            return
        after.append(x)
        for i in range(1, len(before)):
            y = before[i]%x
            if y != 0:
                after.append(y)
        after.sort()
        before = after
        after = [] _ range(pow(10, 9)) range pow(10, 9) pow 10 9 x = before[0] x before[0] before 0 if len(before) == 1:
            print(x)
            return
         len(before) == 1 len(before) len before 1 print(x) print x return after.append(x) after.append after append x for i in range(1, len(before)):
            y = before[i]%x
            if y != 0:
                after.append(y)
         i range(1, len(before)) range 1 len(before) len before y = before[i]%x y before[i]%x before[i] before i x if y != 0:
                after.append(y)
         y != 0 y 0 after.append(y) after.append after append y after.sort() after.sort after sort before = after before after after = [] after [] if __name__ == "__main__":
    main() __name__ == "__main__" __name__ "__main__" main() main def main():
    N = int(input())
    A = list(map(int, input().split()))
    A.sort()
    before = A
    after = []
    for _ in range(pow(10, 9)):
        x = before[0]
        if len(before) == 1:
            print(x)
            return
        after.append(x)
        for i in range(1, len(before)):
            y = before[i]%x
            if y != 0:
                after.append(y)
        after.sort()
        before = after
        after = [] def main():
    N = int(input())
    A = list(map(int, input().split()))
    A.sort()
    before = A
    after = []
    for _ in range(pow(10, 9)):
        x = before[0]
        if len(before) == 1:
            print(x)
            return
        after.append(x)
        for i in range(1, len(before)):
            y = before[i]%x
            if y != 0:
                after.append(y)
        after.sort()
        before = after
        after = [] main
def main():
    N = int(input())
    A = list(map(int, input().split()))
    A.sort()
    before = A
    after = []
    for _ in range(pow(10, 9)):
        x = before[0]
        if len(before) == 1:
            print(x)
            return
        after.append(x)
        for i in range(1, len(before)):
            y = before[i]%x
            if y != 0:
                after.append(y)
        after.sort()
        before = after
        after = []

if __name__ == "__main__":
    main()
