unittest
{
	assert( [ "4", "2 10 8 40" ].parse.expand.solve == 2 );
	assert( [ "4", "5 13 8 1000000000" ].parse.expand.solve == 1 );
	assert( [ "3", "1000000000 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 )
{
	// 最大公約数をとる
	auto ans = as[ 0 ];
	foreach( a; as[ 1 .. $ ] )
	{
		ans = ans.gcd( a );
	}
	return ans;
}
