import sys
def input():
    return sys.stdin.readline()[:-1]
def gcd(a,b):
    if b == 0:
        return a
    return gcd(b,a%b)

def main():
    N = int(input())
    A = list(map(int,input().split()))
    ans = A[0]
    for e in A[1:]:
        ans = gcd(ans,e)
    print(ans)
if __name__ == '__main__':
    main() import sys sys def input():
    return sys.stdin.readline()[:-1] input return sys.stdin.readline()[:-1] sys.stdin.readline()[:-1] sys.stdin.readline() sys.stdin.readline sys.stdin sys stdin readline :-1 -1 def gcd(a,b):
    if b == 0:
        return a
    return gcd(b,a%b) gcd if b == 0:
        return a
     b == 0 b 0 return a a return gcd(b,a%b) gcd(b,a%b) gcd b a%b a b a a b b def main():
    N = int(input())
    A = list(map(int,input().split()))
    ans = A[0]
    for e in A[1:]:
        ans = gcd(ans,e)
    print(ans) main 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 e in A[1:]:
        ans = gcd(ans,e)
     e A[1:] A 1: 1 ans = gcd(ans,e) ans gcd(ans,e) gcd ans e print(ans) print ans if __name__ == '__main__':
    main() __name__ == '__main__' __name__ '__main__' main() main def main():
    N = int(input())
    A = list(map(int,input().split()))
    ans = A[0]
    for e in A[1:]:
        ans = gcd(ans,e)
    print(ans) def main():
    N = int(input())
    A = list(map(int,input().split()))
    ans = A[0]
    for e in A[1:]:
        ans = gcd(ans,e)
    print(ans) main def input():
    return sys.stdin.readline()[:-1] def input():
    return sys.stdin.readline()[:-1] input def gcd(a,b):
    if b == 0:
        return a
    return gcd(b,a%b) def gcd(a,b):
    if b == 0:
        return a
    return gcd(b,a%b) gcd
import sys
def input():
    return sys.stdin.readline()[:-1]
def gcd(a,b):
    if b == 0:
        return a
    return gcd(b,a%b)

def main():
    N = int(input())
    A = list(map(int,input().split()))
    ans = A[0]
    for e in A[1:]:
        ans = gcd(ans,e)
    print(ans)
if __name__ == '__main__':
    main()
