import sys
import math
input = lambda: sys.stdin.readline().rstrip()

def main():
    n = int(input())
    a = list(map(int, input().split()))
    for i in range(1, n):
        if i == 1:
            ans = math.gcd(a[i-1], a[i])
        else:
            ans = math.gcd(ans, a[i])
    print(ans)
        
if __name__ == '__main__':
    main() import sys sys import math math input = lambda: sys.stdin.readline().rstrip() input lambda: 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()))
    for i in range(1, n):
        if i == 1:
            ans = math.gcd(a[i-1], a[i])
        else:
            ans = math.gcd(ans, a[i])
    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 for i in range(1, n):
        if i == 1:
            ans = math.gcd(a[i-1], a[i])
        else:
            ans = math.gcd(ans, a[i])
     i range(1, n) range 1 n if i == 1:
            ans = math.gcd(a[i-1], a[i])
        else:
            ans = math.gcd(ans, a[i])
     i == 1 i 1 ans = math.gcd(a[i-1], a[i]) ans math.gcd(a[i-1], a[i]) math.gcd math gcd a[i-1] a i-1 i 1 a[i] a i 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 if __name__ == '__main__':
    main() __name__ == '__main__' __name__ '__main__' main() main input = lambda: sys.stdin.readline().rstrip() lambda: sys.stdin.readline().rstrip() input def main():
    n = int(input())
    a = list(map(int, input().split()))
    for i in range(1, n):
        if i == 1:
            ans = math.gcd(a[i-1], a[i])
        else:
            ans = math.gcd(ans, a[i])
    print(ans)
         def main():
    n = int(input())
    a = list(map(int, input().split()))
    for i in range(1, n):
        if i == 1:
            ans = math.gcd(a[i-1], a[i])
        else:
            ans = math.gcd(ans, a[i])
    print(ans)
         main
import sys
import math
input = lambda: sys.stdin.readline().rstrip()

def main():
    n = int(input())
    a = list(map(int, input().split()))
    for i in range(1, n):
        if i == 1:
            ans = math.gcd(a[i-1], a[i])
        else:
            ans = math.gcd(ans, a[i])
    print(ans)
        
if __name__ == '__main__':
    main()