#include<stdio.h>
long long gcd(long long a,long long b)
{
	long long c;
	while (b>0)
	{
		c=a%b;
		a=b;
		b=c;
	}
	return a;
}
int main()
{
	long long n;
	while (scanf("%lld",&n)!=EOF)
	{
		long long i,a[1000];
		for(i=0;i<n;i++)
		{
			scanf("%lld",&a[i]);
		}
		long long gy,gb;
		gy=gcd(a[0],a[1]);
		if(a[1]>a[0])gb=a[1]?*a[0];
		if(a[0]>a[1])gb=a[0]?*a[1]; 
		for(i=2;i<n;i++)
		{
			gy=gcd(gb,a[i]);
			if(gb>a[i])gb=gb?*a[i];
			if(a[i]>gb)gb=a[i]?*gb;
		}
		printf("%lld\n",gb);
	}
	return 0;
}