import std.stdio;
import std.algorithm;
import std.conv;
import std.range;
import std.string;

int gcd(int m, int n) {
	int a = max(m,n);
	int b = min(m,n);
	if (b == 0) return a;
	return gcd(b, a % b);
}

void main() {
	int n = readln.chomp.to!int;
	int[] as = readln.chomp.split(' ').map!(s => s.to!int).array;
	int all_in = gcd(as[0], as[1]);
	int ex = as[0];
	if (as.length > 2) {
		ex = max(gcd(as[0], as[2]), gcd(as[1], as[2]));
	}
	foreach(a; as[2..$]) {
		ex = max(gcd(ex, a), all_in);
		all_in = gcd(all_in, a);
	}
	ex.write;
}