unittest
{
	assert( [ "3", "7 6 8" ].parse.expand.solve == 2 );
	assert( [ "3", "12 15 18" ].parse.expand.solve == 6 );
	assert( [ "2", "1000000000 1000000000" ].parse.expand.solve == 1000000000 );
}



import std.algorithm;
import std.conv;
import std.numeric : gcd;
import std.range;
import std.stdio;
import std.typecons;

void main()
{
	stdin.byLineCopy.parse.expand.solve.writeln;
}

auto parse( Range )( Range input )
if( isInputRange!Range && is( ElementType!Range == string ) )
{
	auto n = input.front.to!( long );
	input.popFront;
	auto as = input.front.split.to!( long[] );
	return tuple( as );
}

auto solve( long[] as )
{
	as = as.sort().uniq.array;
	
	if( as.length == 1 ) return as[ 0 ];
	
	auto dm = long.max;
	long[] dmis;
	for( auto i = 0L; i + 1 < as.length; i++ )
	{
		auto d = gcd( as[ i ], as[ i + 1 ] );
		if( d == dm )
		{
			if( dmis[ $ - 1 ] == i ) dmis ~= [ i + 1 ];
			else                     dmis ~= [ i, i + 1 ];
		}
		if( d < dm )
		{
			dm   = d;
			dmis = [ i, i + 1 ];
		}
	}
	auto ans = 0L;
	foreach( dmi; dmis )
	{
		ans = max( ans, gcd( as[ 0 .. dmi ] ~ as[ dmi + 1 .. $ ] ) );
	}
	return ans;
}

auto gcd( long[] bs ... )
{
	auto a = bs[ 0 ];
	foreach( b; bs[ 1 .. $ ] )
	{
		a = a.gcd( b );
	}
	return a;
}
