from fractions import gcd

def mi():
    return map(int, input().split())

def ii():
    return int(input())

def main():
    N = ii()
    A = list(mi())
    ans = A[0]
    for i in range(N-1):
        ans = gcd(ans, A[i+1])
    print(ans)

if __name__ == '__main__':
    main() from fractions import gcd def mi():
    return map(int, input().split()) mi return map(int, input().split()) map(int, input().split()) map int input().split() ().split () input split def ii():
    return int(input()) ii return int(input()) int(input()) int input() input def main():
    N = ii()
    A = list(mi())
    ans = A[0]
    for i in range(N-1):
        ans = gcd(ans, A[i+1])
    print(ans) main N = ii() N ii() ii A = list(mi()) A list(mi()) list mi() mi ans = A[0] ans A[0] A 0 for i in range(N-1):
        ans = gcd(ans, A[i+1])
     i range(N-1) range N-1 N 1 ans = gcd(ans, A[i+1]) ans gcd(ans, A[i+1]) gcd ans A[i+1] A i+1 i 1 print(ans) print ans if __name__ == '__main__':
    main() __name__ == '__main__' __name__ '__main__' main() main def mi():
    return map(int, input().split()) def mi():
    return map(int, input().split()) mi def main():
    N = ii()
    A = list(mi())
    ans = A[0]
    for i in range(N-1):
        ans = gcd(ans, A[i+1])
    print(ans) def main():
    N = ii()
    A = list(mi())
    ans = A[0]
    for i in range(N-1):
        ans = gcd(ans, A[i+1])
    print(ans) main def ii():
    return int(input()) def ii():
    return int(input()) ii
from fractions import gcd

def mi():
    return map(int, input().split())

def ii():
    return int(input())

def main():
    N = ii()
    A = list(mi())
    ans = A[0]
    for i in range(N-1):
        ans = gcd(ans, A[i+1])
    print(ans)

if __name__ == '__main__':
    main()