import sys

def I(): return int(sys.stdin.readline())
def MI(): return map(int, sys.stdin.readline().split())
def LI(): return list(map(int, sys.stdin.readline().split()))
def main():
    n = I()
    A = LI()
    while True:
        ans = min(A)
        A = [x%ans for x in A if x%ans != 0]
        if not A:
            print(ans)
            break
        A.append(ans)


if __name__ == '__main__':
    main() import sys sys def I(): return int(sys.stdin.readline()) I def MI(): return map(int, sys.stdin.readline().split()) MI def LI(): return list(map(int, sys.stdin.readline().split())) LI def main():
    n = I()
    A = LI()
    while True:
        ans = min(A)
        A = [x%ans for x in A if x%ans != 0]
        if not A:
            print(ans)
            break
        A.append(ans) main n = I() n I() I A = LI() A LI() LI while True:
        ans = min(A)
        A = [x%ans for x in A if x%ans != 0]
        if not A:
            print(ans)
            break
        A.append(ans) True ans = min(A) ans min(A) min A x%ans for x in A if x%ans != 0 for x in A if x%ans != 0 x A x%ans != 0 x%ans x ans 0 if x%ans != 0 x%ans x ans A = [x%ans for x in A if x%ans != 0] A [x%ans for x in A if x%ans != 0] if not A:
            print(ans)
            break
         not A A print(ans) print ans break A.append(ans) A.append A append ans if __name__ == '__main__':
    main() __name__ == '__main__' __name__ '__main__' main() main def LI(): return list(map(int, sys.stdin.readline().split())) def LI(): return list(map(int, sys.stdin.readline().split())) LI def main():
    n = I()
    A = LI()
    while True:
        ans = min(A)
        A = [x%ans for x in A if x%ans != 0]
        if not A:
            print(ans)
            break
        A.append(ans) def main():
    n = I()
    A = LI()
    while True:
        ans = min(A)
        A = [x%ans for x in A if x%ans != 0]
        if not A:
            print(ans)
            break
        A.append(ans) main def I(): return int(sys.stdin.readline()) def I(): return int(sys.stdin.readline()) I def MI(): return map(int, sys.stdin.readline().split()) def MI(): return map(int, sys.stdin.readline().split()) MI
import sys

def I(): return int(sys.stdin.readline())
def MI(): return map(int, sys.stdin.readline().split())
def LI(): return list(map(int, sys.stdin.readline().split()))
def main():
    n = I()
    A = LI()
    while True:
        ans = min(A)
        A = [x%ans for x in A if x%ans != 0]
        if not A:
            print(ans)
            break
        A.append(ans)


if __name__ == '__main__':
    main()