import sys

from functools import lru_cache

def input(): return sys.stdin.readline().rstrip()



@lru_cache(maxsize=None)

def gcd(m, n):

    if n == 0:

        return m

    else:

        return gcd(n, m % n)



def main():

    _ = int(eval(input()))

    A = tuple(map(int, input().split()))



    ans = A[0]

    for a in A[1:]:

        ans = gcd(ans, a)

    print(ans)

    

if __name__ == '__main__':

    main()

import sys

from fractions import gcd

def input(): return sys.stdin.readline().rstrip()



def main():

    _ = int(eval(input()))

    A = tuple(map(int, input().split()))



    ans = A[0]

    for a in A[1:]:

        ans = gcd(ans, a)

    print(ans)

    

if __name__ == '__main__':

    main()

import sys
from functools import lru_cache


def input():
    return sys.stdin.readline().rstrip()


@lru_cache(maxsize=None)
def gcd(m, n):
    if n == 0:
        return m
    else:
        return gcd(n, m % n)


def main():
    _ = int(eval(input()))
    A = tuple(map(int, input().split()))
    ans = A[0]
    for a in A[1:]:
        ans = gcd(ans, a)
    print(ans)


if __name__ == "__main__":
    main()

import sys
from fractions import gcd


def input():
    return sys.stdin.readline().rstrip()


def main():
    _ = int(eval(input()))
    A = tuple(map(int, input().split()))
    ans = A[0]
    for a in A[1:]:
        ans = gcd(ans, a)
    print(ans)


if __name__ == "__main__":
    main()

-from functools import lru_cache +from fractions import gcd - - -@lru_cache(maxsize=None) -def gcd(m, n): -    if n == 0: -        return m -    else: -        return gcd(n, m % n)