import sys
from math import gcd
input = sys.stdin.readline
N = int(input())
res = 0
a = list(map(int, input().split()))
for x in a: res = gcd(res, x)
print(res) import sys sys from math import gcd input = sys.stdin.readline input sys.stdin.readline sys.stdin sys stdin readline N = int(input()) N int(input()) int input() input res = 0 res 0 a = list(map(int, input().split())) a list(map(int, input().split())) list map(int, input().split()) map int input().split() ().split () input split for x in a: res = gcd(res, x) x a print(res) print res N = int(input()) int(input()) N input = sys.stdin.readline sys.stdin.readline input res = 0 0 res a = list(map(int, input().split())) list(map(int, input().split())) a
import sys
from math import gcd
input = sys.stdin.readline
N = int(input())
res = 0
a = list(map(int, input().split()))
for x in a: res = gcd(res, x)
print(res)