import math
import collections
import fractions
import itertools
import functools
import operator
import bisect

def solve():
    n = int(input())
    a = list(map(int, input().split()))
    ans = a[0]
    for i in range(1, n):
        ans = math.gcd(ans, a[i])
    print(ans)
    return 0

if __name__ == "__main__":
    solve() import math math import collections collections import fractions fractions import itertools itertools import functools functools import operator operator import bisect bisect def solve():
    n = int(input())
    a = list(map(int, input().split()))
    ans = a[0]
    for i in range(1, n):
        ans = math.gcd(ans, a[i])
    print(ans)
    return 0 solve 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 ans = a[0] ans a[0] a 0 for i in range(1, n):
        ans = math.gcd(ans, a[i])
     i range(1, n) range 1 n ans = math.gcd(ans, a[i]) ans math.gcd(ans, a[i]) math.gcd math gcd ans a[i] a i print(ans) print ans return 0 0 if __name__ == "__main__":
    solve() __name__ == "__main__" __name__ "__main__" solve() solve def solve():
    n = int(input())
    a = list(map(int, input().split()))
    ans = a[0]
    for i in range(1, n):
        ans = math.gcd(ans, a[i])
    print(ans)
    return 0 def solve():
    n = int(input())
    a = list(map(int, input().split()))
    ans = a[0]
    for i in range(1, n):
        ans = math.gcd(ans, a[i])
    print(ans)
    return 0 solve
import math
import collections
import fractions
import itertools
import functools
import operator
import bisect

def solve():
    n = int(input())
    a = list(map(int, input().split()))
    ans = a[0]
    for i in range(1, n):
        ans = math.gcd(ans, a[i])
    print(ans)
    return 0

if __name__ == "__main__":
    solve()