#include <bits/stdc++.h>
using namespace std;

typedef long long ll;
typedef unsigned long long ull;

#define mp make_pair
#define fr first
#define sc second

int gcd(int x,int y){
	if(y==0)return x;
	return gcd(y,x%y);
}

int main(){
	int n,ret=0;
	scanf("%d",&n);
	for(int i=0;i<n;i++){
		int a;
		scanf("%d",&a);
		ret=gcd(ret,a);
	}
	cout<<ret<<endl;
}
	#include <bits/stdc++.h>
	using namespace std;
	typedef long long ll;
	#define PI 3.14159265358979
	#define EPS 1e-8
	#define mod  1000000007
	#define fi first
	#define se second
	#define mp make_pair
	#define pb push_back
	#define endl "\n"
	#define NEG_INF -2e18
				 
	const ll INF=1e15;	
	const int N=4e5+50;
	 
	ll fac[N];		 
	 
	 long long binpow(long long a, long long b, long long m) {
						a %= m;
						long long res = 1;
						while (b > 0) {
							if (b & 1)
								res = res * a % m;
							a = a * a % m;
							b >>= 1;
			}
			return res;
	}
	 
	ll modinverse(ll a,ll m)
	{
		return binpow(a,m-2,m);
	}
					
	ll nck(ll n,ll r)
	{
		return ((fac[n]*modinverse(fac[r],mod)) % mod)*modinverse(fac[n-r],mod)%mod;
		
	}
	 
	 
	int main()
	{
		ios_base::sync_with_stdio(false);
		cin.tie(NULL);cout.tie(0);
		
		ll n;
		cin>>n;
		
		vector<ll> v(n);
		
		for(ll i=0;i<n;i++)
			cin>>v[i];
			
		sort(v.begin(),v.end());
		ll g=v[0];
		
		for(ll i=1;i<n;i++)
		{
			g=__gcd(g,v[i]-v[0]);
		}
		cout<<g;
		
	}
