import sys

from fractions import gcd

sys.setrecursionlimit(10**9)

INF=10**18

MOD=10**9+7

def input():

    return sys.stdin.readline().rstrip()



def main():

    N=int(eval(input()))

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

    ans=A[0]

    for x in A[1:]:

        ans=gcd(ans,x)

    print(ans)

    

    



if __name__ == '__main__':

    main()

# -*- coding: utf-8 -*-

import sys

from math import gcd

sys.setrecursionlimit(10**9)

INF=10**18

MOD=10**9+7

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

YesNo=lambda b: bool([print('Yes')] if b else print('No'))

YESNO=lambda b: bool([print('YES')] if b else print('NO'))

int1=lambda x:int(x)-1



N=int(input())

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

ans=A[0]

for x in A[1:]:

    ans=gcd(ans,x)

print(ans)

import sys
from fractions import gcd

sys.setrecursionlimit(10**9)
INF = 10**18
MOD = 10**9 + 7


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


def main():
    N = int(eval(input()))
    A = list(map(int, input().split()))
    ans = A[0]
    for x in A[1:]:
        ans = gcd(ans, x)
    print(ans)


if __name__ == "__main__":
    main()

# -*- coding: utf-8 -*-
import sys
from math import gcd

sys.setrecursionlimit(10**9)
INF = 10**18
MOD = 10**9 + 7
input = lambda: sys.stdin.readline().rstrip()
YesNo = lambda b: bool([print("Yes")] if b else print("No"))
YESNO = lambda b: bool([print("YES")] if b else print("NO"))
int1 = lambda x: int(x) - 1
N = int(input())
A = list(map(int, input().split()))
ans = A[0]
for x in A[1:]:
    ans = gcd(ans, x)
print(ans)

+# -*- coding: utf-8 -*- -from fractions import gcd +from math import gcd - - -def input(): -    return sys.stdin.readline().rstrip() - - -def main(): -    N = int(eval(input())) -    A = list(map(int, input().split())) -    ans = A[0] -    for x in A[1:]: -        ans = gcd(ans, x) -    print(ans) - - -if __name__ == "__main__": -    main() +input = lambda: sys.stdin.readline().rstrip() +YesNo = lambda b: bool([print("Yes")] if b else print("No")) +YESNO = lambda b: bool([print("YES")] if b else print("NO")) +int1 = lambda x: int(x) - 1 +N = int(input()) +A = list(map(int, input().split())) +ans = A[0] +for x in A[1:]: +    ans = gcd(ans, x) +print(ans)