import numpy as np
from functools import lru_cache
import sys
sys.setrecursionlimit(10**6)

n = int(input())
a = list(map(int, input().split()))


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


ans = a[0]

for i in a[1:]:
    ans = gcd(ans, i)

print(ans) import numpy as np numpy from functools import lru_cache import sys sys sys.setrecursionlimit(10**6) sys.setrecursionlimit sys setrecursionlimit 10**6 10 6 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 def gcd(a, b):
    if (b == 0):
        return a
    else:
        return gcd(b, a % b) gcd if (b == 0):
        return a
    else:
        return gcd(b, a % b) b == 0 b 0 return a a return gcd(b, a % b) gcd(b, a % b) gcd b a % b a b a a b b @lru_cache(maxsize=None) gcd maxsize=None @lru_cache(maxsize=None) lru_cache maxsize=None maxsize None gcd ans = a[0] ans a[0] a 0 for i in a[1:]:
    ans = gcd(ans, i) i a[1:] a 1: 1 ans = gcd(ans, i) ans gcd(ans, i) gcd ans i print(ans) print ans ans = a[0] a[0] ans ans = gcd(ans, i) gcd(ans, i) ans n = int(input()) int(input()) n def gcd(a, b):
    if (b == 0):
        return a
    else:
        return gcd(b, a % b) def gcd(a, b):
    if (b == 0):
        return a
    else:
        return gcd(b, a % b) gcd a = list(map(int, input().split())) list(map(int, input().split())) a
import numpy as np
from functools import lru_cache
import sys
sys.setrecursionlimit(10**6)

n = int(input())
a = list(map(int, input().split()))


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


ans = a[0]

for i in a[1:]:
    ans = gcd(ans, i)

print(ans)