import sys
from collections import defaultdict
import math

def input():
    return sys.stdin.readline().rstrip()


def main():
    N = int(input())
    A = list(map(int,input().split()))
    A.sort(reverse=True)
    g = A[0]

    for i in range(1,N):
        g = math.gcd(g,A[i])

    print(g)





if __name__ == "__main__":
    main() import sys sys from collections import defaultdict import math math def input():
    return sys.stdin.readline().rstrip() input return sys.stdin.readline().rstrip() sys.stdin.readline().rstrip() sys.stdin.readline().rstrip sys.stdin.readline() sys.stdin.readline sys.stdin sys stdin readline rstrip def main():
    N = int(input())
    A = list(map(int,input().split()))
    A.sort(reverse=True)
    g = A[0]

    for i in range(1,N):
        g = math.gcd(g,A[i])

    print(g) 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 A.sort(reverse=True) A.sort A sort reverse=True reverse True g = A[0] g A[0] A 0 for i in range(1,N):
        g = math.gcd(g,A[i])

     i range(1,N) range 1 N g = math.gcd(g,A[i]) g math.gcd(g,A[i]) math.gcd math gcd g A[i] A i print(g) print g if __name__ == "__main__":
    main() __name__ == "__main__" __name__ "__main__" main() main def input():
    return sys.stdin.readline().rstrip() def input():
    return sys.stdin.readline().rstrip() input def main():
    N = int(input())
    A = list(map(int,input().split()))
    A.sort(reverse=True)
    g = A[0]

    for i in range(1,N):
        g = math.gcd(g,A[i])

    print(g) def main():
    N = int(input())
    A = list(map(int,input().split()))
    A.sort(reverse=True)
    g = A[0]

    for i in range(1,N):
        g = math.gcd(g,A[i])

    print(g) main
import sys
from collections import defaultdict
import math

def input():
    return sys.stdin.readline().rstrip()


def main():
    N = int(input())
    A = list(map(int,input().split()))
    A.sort(reverse=True)
    g = A[0]

    for i in range(1,N):
        g = math.gcd(g,A[i])

    print(g)





if __name__ == "__main__":
    main()
