function gcd(x, y)
	return y == 0 and x or gcd(y, x % y)
end
n = io.read"*n"
a = {}
for i=1,n do
	a[i] = io.read"*n"
end
r=0
for i=1,n do
	t = {table.unpack(a)}
	t[i] = a[i+1] or a[i-1]
	for j=1,n-1 do
		t[1] = gcd(t[1],t[j+1])
	end
	r = t[1]
end
print(r)