import sys

def gcd(a, b):
    a, b = max(a, b), min(a, b)
    while a % b > 0:
        a, b = b, a % b
    return b

def solve():
    input = sys.stdin.readline
    N = int(input())
    A = [int(i) for i in input().split()]
    gcdA = A[0]
    for a in A: gcdA = gcd(gcdA, a)
    print(gcdA)

    return 0

if __name__ == "__main__":
    solve() import sys sys def gcd(a, b):
    a, b = max(a, b), min(a, b)
    while a % b > 0:
        a, b = b, a % b
    return b gcd a, b = max(a, b), min(a, b) a max(a, b) max a b b min(a, b) min a b while a % b > 0:
        a, b = b, a % b
     a % b > 0 a % b a b 0 a, b = b, a % b a b b a % b a b return b b a a b b def solve():
    input = sys.stdin.readline
    N = int(input())
    A = [int(i) for i in input().split()]
    gcdA = A[0]
    for a in A: gcdA = gcd(gcdA, a)
    print(gcdA)

    return 0 solve input = sys.stdin.readline input sys.stdin.readline sys.stdin sys stdin readline N = int(input()) N int(input()) int input() input int(i) for i in input().split() for i in input().split() i input().split() ().split () input split for i in input().split() int(i) int i A = [int(i) for i in input().split()] A [int(i) for i in input().split()] gcdA = A[0] gcdA A[0] A 0 for a in A: gcdA = gcd(gcdA, a)
     a A print(gcdA) print gcdA return 0 0 if __name__ == "__main__":
    solve() __name__ == "__main__" __name__ "__main__" solve() solve def gcd(a, b):
    a, b = max(a, b), min(a, b)
    while a % b > 0:
        a, b = b, a % b
    return b def gcd(a, b):
    a, b = max(a, b), min(a, b)
    while a % b > 0:
        a, b = b, a % b
    return b gcd def solve():
    input = sys.stdin.readline
    N = int(input())
    A = [int(i) for i in input().split()]
    gcdA = A[0]
    for a in A: gcdA = gcd(gcdA, a)
    print(gcdA)

    return 0 def solve():
    input = sys.stdin.readline
    N = int(input())
    A = [int(i) for i in input().split()]
    gcdA = A[0]
    for a in A: gcdA = gcd(gcdA, a)
    print(gcdA)

    return 0 solve
import sys

def gcd(a, b):
    a, b = max(a, b), min(a, b)
    while a % b > 0:
        a, b = b, a % b
    return b

def solve():
    input = sys.stdin.readline
    N = int(input())
    A = [int(i) for i in input().split()]
    gcdA = A[0]
    for a in A: gcdA = gcd(gcdA, a)
    print(gcdA)

    return 0

if __name__ == "__main__":
    solve()