n = gets.chomp!.to_i
as = gets.chomp!.split(" ")
as = as.map{|item| item = item.to_i}

ans = -Float::INFINITY

def mygcd(n1,n2)
	arr = [n1,n2,n1%n2]

	while arr[2] != 0
		arr[0] = arr[1]
		arr[1] = arr[2]
		arr[2] = arr[0] % arr[1]
	end

	return arr[1]
end

for kosu in 0..n
	as.combination(n-1){|arr| 
		alans = mygcd(arr[0],arr[1])
		for i in 2..n-2
			alans = mygcd(alans,arr[i])
		end
		
		if ans <= alans then
		ans = alans
		end
	}
end

puts ans