import sys

IS = lambda: sys.stdin.readline().rstrip()

II = lambda: int(IS())

MII = lambda: list(map(int, IS().split()))



def main():

    n = II()

    a_lst = sorted(MII(), reverse=True)

    while True:

        minv = a_lst[-1]

        a_lst = [a%minv for a in a_lst[:-1] if a%minv != 0]

        a_lst.append(minv)

        a_lst.sort(reverse=True)

        if len(a_lst) == 1: break

    print((a_lst[0]))



if __name__ == '__main__':

    main()

"""

keywords: 最大公約数、ユークリッドの互除法

"""

import sys

IS = lambda: sys.stdin.readline().rstrip()

II = lambda: int(IS())

MII = lambda: list(map(int, IS().split()))

from functools import reduce



def gcd(a, b):

    while b:

        a, b = b, a%b

    return a



def main():

    n = II()

    a_lst = MII()

    print((reduce(gcd, a_lst)))



if __name__ == '__main__':

    main()

import sys

IS = lambda: sys.stdin.readline().rstrip()
II = lambda: int(IS())
MII = lambda: list(map(int, IS().split()))


def main():
    n = II()
    a_lst = sorted(MII(), reverse=True)
    while True:
        minv = a_lst[-1]
        a_lst = [a % minv for a in a_lst[:-1] if a % minv != 0]
        a_lst.append(minv)
        a_lst.sort(reverse=True)
        if len(a_lst) == 1:
            break
    print((a_lst[0]))


if __name__ == "__main__":
    main()

"""
keywords: 最大公約数、ユークリッドの互除法
"""
import sys

IS = lambda: sys.stdin.readline().rstrip()
II = lambda: int(IS())
MII = lambda: list(map(int, IS().split()))
from functools import reduce


def gcd(a, b):
    while b:
        a, b = b, a % b
    return a


def main():
    n = II()
    a_lst = MII()
    print((reduce(gcd, a_lst)))


if __name__ == "__main__":
    main()

+""" +keywords: 最大公約数、ユークリッドの互除法 +""" +from functools import reduce + + +def gcd(a, b): +    while b: +        a, b = b, a % b +    return a -    a_lst = sorted(MII(), reverse=True) -    while True: -        minv = a_lst[-1] -        a_lst = [a % minv for a in a_lst[:-1] if a % minv != 0] -        a_lst.append(minv) -        a_lst.sort(reverse=True) -        if len(a_lst) == 1: -            break -    print((a_lst[0])) +    a_lst = MII() +    print((reduce(gcd, a_lst)))