process.stdin.resume();
process.stdin.setEncoding('utf8'); 
var lines = [];
var reader = require('readline').createInterface({
	input: process.stdin,
	output: process.stdout
});
 
reader.on('line', (line) => {
	lines.push(line);
});

reader.on('close', () => {
	"use strict"
	const memo = new Map();
	const GCD = (n, m) => {
		if(n==1 || m==1){return n*m;}
		const l = n>=m ? n : m;
		const s = n>=m ? m : n;
		
		if(!memo.has(l)){
			memo.set(l, new Map());
		}
		if(memo.get(l).has(s)){return memo.get(l).get(s);}
		
		if(l%s) {
			const next = GCD(s, l%s);
			memo.get(l).set(s, next);
			return next;
		} else {
			memo.get(l).set(s, GCD(s, s));
			return s;
		}
	}
	
	const N = +lines[0];
	const A = lines[1].split(" ").map(Number);
	
	const ans = A.map((e, i) => A.filter((e, j) => i!=j).reduce(GCD)).reduce((x,y) => Math.max(x,y));
	console.log(ans);
});

