def INT():
    return int(input())

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

def LI():
    return list(map(int, input().split()))

from math import gcd

N = INT()
A = LI()
A.sort()
ans = A[0]

all_can_div = True

for i in range(1, N):
    A[i] = gcd(A[i], ans)
    
    if A[i] != ans and all_can_div:
        all_can_div = False

print(ans if all_can_div else min(A)) def INT():
    return int(input()) INT return int(input()) int(input()) int input() input 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 LI():
    return list(map(int, input().split())) LI return list(map(int, input().split())) list(map(int, input().split())) list map(int, input().split()) map int input().split() ().split () input split from math import gcd N = INT() N INT() INT A = LI() A LI() LI A.sort() A.sort A sort ans = A[0] ans A[0] A 0 all_can_div = True all_can_div True for i in range(1, N):
    A[i] = gcd(A[i], ans)
    
    if A[i] != ans and all_can_div:
        all_can_div = False i range(1, N) range 1 N A[i] = gcd(A[i], ans) A[i] A i gcd(A[i], ans) gcd A[i] A i ans if A[i] != ans and all_can_div:
        all_can_div = False A[i] != ans and all_can_div A[i] != ans A[i] A i ans all_can_div all_can_div = False all_can_div False print(ans if all_can_div else min(A)) print ans if all_can_div else min(A) all_can_div ans min(A) min A N = INT() INT() N all_can_div = True True all_can_div A = LI() LI() A all_can_div = False False all_can_div def INT():
    return int(input()) def INT():
    return int(input()) INT ans = A[0] A[0] ans def MI():
    return map(int, input().split()) def MI():
    return map(int, input().split()) MI def LI():
    return list(map(int, input().split())) def LI():
    return list(map(int, input().split())) LI
def INT():
    return int(input())

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

def LI():
    return list(map(int, input().split()))

from math import gcd

N = INT()
A = LI()
A.sort()
ans = A[0]

all_can_div = True

for i in range(1, N):
    A[i] = gcd(A[i], ans)
    
    if A[i] != ans and all_can_div:
        all_can_div = False

print(ans if all_can_div else min(A))