n = int(input())
a = list(map(int,input().split()))
a.append(0)
a = sorted(a)

while len(a) > 2:
    for i in range(2,n):
        a[i] %= a[1]
        
    a = sorted(set(a))
    n = len(a)
    
print(a[1]) 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.append(0) a.append a append 0 a = sorted(a) a sorted(a) sorted a while len(a) > 2:
    for i in range(2,n):
        a[i] %= a[1]
        
    a = sorted(set(a))
    n = len(a)
     len(a) > 2 len(a) len a 2 for i in range(2,n):
        a[i] %= a[1]
        
     i range(2,n) range 2 n a[i] %= a[1] a[i] a i a[1] a 1 a = sorted(set(a)) a sorted(set(a)) sorted set(a) set a n = len(a) n len(a) len a print(a[1]) print a[1] a 1 a = list(map(int,input().split())) list(map(int,input().split())) a n = len(a) len(a) n n = int(input()) int(input()) n a = sorted(set(a)) sorted(set(a)) a a = sorted(a) sorted(a) a
n = int(input())
a = list(map(int,input().split()))
a.append(0)
a = sorted(a)

while len(a) > 2:
    for i in range(2,n):
        a[i] %= a[1]
        
    a = sorted(set(a))
    n = len(a)
    
print(a[1])