function gcd(arr) {
    var f = (a, b) => b ? f(b, a % b) : a
    var ans = arr[0]
    for (var i = 1; i < arr.length; i++) {
        ans = f(ans, arr[i]); 
    }
    return ans 
}

function main(arg) {
	arg = arg.trim().split("\n")
	var N = Number(arg[0])
	var A = arg[1].split(" ").map(Number)
	var c = new Array(A.length - 1).fill(0)
	var tmp = []
	var result = 0
	for (var i = 0; i < A.length; i++) {
		var _A = A.slice()
		_A.splice(i, 1)
		var next = A[i+1]
		if (!next) {
			next = A[0]
		}
		var n = gcd([A[i], next])
		// var n = gcd(_A)
		if (n > 1) {
			tmp.push(n)
		}
		c[i] = n
	}
	// console.log(tmp)
	// console.log(c)
	var b = tmp.filter(function (x, i, self) {
		return self.indexOf(x) === i
	}).sort((a,b) => b - a)
	for (var i = 0; i < b.length; i++) {
		var t = b[i]
		var count = 0
		for (var j = 0; j < A.length; j++) {
			var n = gcd([t, A[j]])
			// console.log([n,t])
			if (n !== t) {
				count++
			}
		}
			
		if (count <= 1) {
			console.log(t)
			return
		}
	}
	// console.log(b)
}
main(require('fs').readFileSync('/dev/stdin', 'utf8'));