def main():
    n = int(input())
    a = list(map(int, input().split()))
    m = min(a)
    next_m = m
    count = 0
    while count != n:
        m = next_m
        count = 0
        pre = a[0]
        for i in range(n):
            if a[i] == pre:
                count += 1
            a[i] %= m
            if a[i] != 0:
                next_m = min(next_m, a[i])
            else:
                a[i] = m
            pre = a[i]
    print(m)
    
if __name__ == '__main__':
    main() def main():
    n = int(input())
    a = list(map(int, input().split()))
    m = min(a)
    next_m = m
    count = 0
    while count != n:
        m = next_m
        count = 0
        pre = a[0]
        for i in range(n):
            if a[i] == pre:
                count += 1
            a[i] %= m
            if a[i] != 0:
                next_m = min(next_m, a[i])
            else:
                a[i] = m
            pre = a[i]
    print(m)
     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 m = min(a) m min(a) min a next_m = m next_m m count = 0 count 0 while count != n:
        m = next_m
        count = 0
        pre = a[0]
        for i in range(n):
            if a[i] == pre:
                count += 1
            a[i] %= m
            if a[i] != 0:
                next_m = min(next_m, a[i])
            else:
                a[i] = m
            pre = a[i]
     count != n count n m = next_m m next_m count = 0 count 0 pre = a[0] pre a[0] a 0 for i in range(n):
            if a[i] == pre:
                count += 1
            a[i] %= m
            if a[i] != 0:
                next_m = min(next_m, a[i])
            else:
                a[i] = m
            pre = a[i]
     i range(n) range n if a[i] == pre:
                count += 1
             a[i] == pre a[i] a i pre count += 1 count 1 a[i] %= m a[i] a i m if a[i] != 0:
                next_m = min(next_m, a[i])
            else:
                a[i] = m
             a[i] != 0 a[i] a i 0 next_m = min(next_m, a[i]) next_m min(next_m, a[i]) min next_m a[i] a i a[i] = m a[i] a i m pre = a[i] pre a[i] a i print(m) print m if __name__ == '__main__':
    main() __name__ == '__main__' __name__ '__main__' main() main def main():
    n = int(input())
    a = list(map(int, input().split()))
    m = min(a)
    next_m = m
    count = 0
    while count != n:
        m = next_m
        count = 0
        pre = a[0]
        for i in range(n):
            if a[i] == pre:
                count += 1
            a[i] %= m
            if a[i] != 0:
                next_m = min(next_m, a[i])
            else:
                a[i] = m
            pre = a[i]
    print(m)
     def main():
    n = int(input())
    a = list(map(int, input().split()))
    m = min(a)
    next_m = m
    count = 0
    while count != n:
        m = next_m
        count = 0
        pre = a[0]
        for i in range(n):
            if a[i] == pre:
                count += 1
            a[i] %= m
            if a[i] != 0:
                next_m = min(next_m, a[i])
            else:
                a[i] = m
            pre = a[i]
    print(m)
     main
def main():
    n = int(input())
    a = list(map(int, input().split()))
    m = min(a)
    next_m = m
    count = 0
    while count != n:
        m = next_m
        count = 0
        pre = a[0]
        for i in range(n):
            if a[i] == pre:
                count += 1
            a[i] %= m
            if a[i] != 0:
                next_m = min(next_m, a[i])
            else:
                a[i] = m
            pre = a[i]
    print(m)
    
if __name__ == '__main__':
    main()