# -*- coding: utf-8 -*-
import sys
from collections import deque, defaultdict
from math import sqrt, factorial, gcd
# def input(): return sys.stdin.readline()[:-1] # warning not \n
# def input(): return sys.stdin.buffer.readline().strip() # warning bytes
# def input(): return sys.stdin.buffer.readline().decode('utf-8')


def solve():
    n = int(input())
    a = [int(x) for x in input().split()]
    mn = min(a)
    while True:
        b = set()
        for e in a:
            if e % mn:
                b.add(e%mn)
            else:
                b.add(mn)
        a = list(b)
        mn = min(a)
        if len(a) == 1:
            print(mn)
            return
    

t = 1
# t = int(input())
for case in range(1,t+1):
    ans = solve()


"""

2 3 4 4
3 4 4
2 3 4
2 3 4
2 4 4


""" import sys sys from collections import deque, defaultdict from math import sqrt, factorial, gcd def solve():
    n = int(input())
    a = [int(x) for x in input().split()]
    mn = min(a)
    while True:
        b = set()
        for e in a:
            if e % mn:
                b.add(e%mn)
            else:
                b.add(mn)
        a = list(b)
        mn = min(a)
        if len(a) == 1:
            print(mn)
            return
     solve n = int(input()) n int(input()) int input() input int(x) for x in input().split() for x in input().split() x input().split() ().split () input split for x in input().split() int(x) int x a = [int(x) for x in input().split()] a [int(x) for x in input().split()] mn = min(a) mn min(a) min a while True:
        b = set()
        for e in a:
            if e % mn:
                b.add(e%mn)
            else:
                b.add(mn)
        a = list(b)
        mn = min(a)
        if len(a) == 1:
            print(mn)
            return
     True b = set() b set() set for e in a:
            if e % mn:
                b.add(e%mn)
            else:
                b.add(mn)
         e a if e % mn:
                b.add(e%mn)
            else:
                b.add(mn)
         e % mn e mn b.add(e%mn) b.add b add e%mn e mn b.add(mn) b.add b add mn a = list(b) a list(b) list b mn = min(a) mn min(a) min a if len(a) == 1:
            print(mn)
            return
     len(a) == 1 len(a) len a 1 print(mn) print mn return t = 1 t 1 for case in range(1,t+1):
    ans = solve() case range(1,t+1) range 1 t+1 t 1 ans = solve() ans solve() solve """

2 3 4 4
3 4 4
2 3 4
2 3 4
2 4 4


""" def solve():
    n = int(input())
    a = [int(x) for x in input().split()]
    mn = min(a)
    while True:
        b = set()
        for e in a:
            if e % mn:
                b.add(e%mn)
            else:
                b.add(mn)
        a = list(b)
        mn = min(a)
        if len(a) == 1:
            print(mn)
            return
     def solve():
    n = int(input())
    a = [int(x) for x in input().split()]
    mn = min(a)
    while True:
        b = set()
        for e in a:
            if e % mn:
                b.add(e%mn)
            else:
                b.add(mn)
        a = list(b)
        mn = min(a)
        if len(a) == 1:
            print(mn)
            return
     solve ans = solve() solve() ans t = 1 1 t
# -*- coding: utf-8 -*-
import sys
from collections import deque, defaultdict
from math import sqrt, factorial, gcd
# def input(): return sys.stdin.readline()[:-1] # warning not \n
# def input(): return sys.stdin.buffer.readline().strip() # warning bytes
# def input(): return sys.stdin.buffer.readline().decode('utf-8')


def solve():
    n = int(input())
    a = [int(x) for x in input().split()]
    mn = min(a)
    while True:
        b = set()
        for e in a:
            if e % mn:
                b.add(e%mn)
            else:
                b.add(mn)
        a = list(b)
        mn = min(a)
        if len(a) == 1:
            print(mn)
            return
    

t = 1
# t = int(input())
for case in range(1,t+1):
    ans = solve()


"""

2 3 4 4
3 4 4
2 3 4
2 3 4
2 4 4


"""
