import math
from math import gcd
INF = float("inf")

import sys
input=sys.stdin.readline
sys.setrecursionlimit(500*500)
import itertools
from collections import Counter,deque

def main():
    n = int(input())
    l = list(map(int, input().split()))
    k = l[0]
    for i in range(1,n):
        k = gcd(k,l[i])
    print(k)


if __name__=="__main__":
    main(
    ) import math math from math import gcd INF = float("inf") INF float("inf") float "inf" import sys sys input=sys.stdin.readline input sys.stdin.readline sys.stdin sys stdin readline sys.setrecursionlimit(500*500) sys.setrecursionlimit sys setrecursionlimit 500*500 500 500 import itertools itertools from collections import Counter,deque def main():
    n = int(input())
    l = list(map(int, input().split()))
    k = l[0]
    for i in range(1,n):
        k = gcd(k,l[i])
    print(k) main n = int(input()) n int(input()) int input() input l = list(map(int, input().split())) l list(map(int, input().split())) list map(int, input().split()) map int input().split() ().split () input split k = l[0] k l[0] l 0 for i in range(1,n):
        k = gcd(k,l[i])
     i range(1,n) range 1 n k = gcd(k,l[i]) k gcd(k,l[i]) gcd k l[i] l i print(k) print k if __name__=="__main__":
    main(
    ) __name__=="__main__" __name__ "__main__" main(
    ) main input=sys.stdin.readline sys.stdin.readline input INF = float("inf") float("inf") INF def main():
    n = int(input())
    l = list(map(int, input().split()))
    k = l[0]
    for i in range(1,n):
        k = gcd(k,l[i])
    print(k) def main():
    n = int(input())
    l = list(map(int, input().split()))
    k = l[0]
    for i in range(1,n):
        k = gcd(k,l[i])
    print(k) main
import math
from math import gcd
INF = float("inf")

import sys
input=sys.stdin.readline
sys.setrecursionlimit(500*500)
import itertools
from collections import Counter,deque

def main():
    n = int(input())
    l = list(map(int, input().split()))
    k = l[0]
    for i in range(1,n):
        k = gcd(k,l[i])
    print(k)


if __name__=="__main__":
    main(
    )
