#include<bits/stdc++.h>
#define rep(i,n) for(int (i)=0;(i) < (n);(i)++)
#define repsec(i,m,n) for(int (i)=(m);(i) < (n);(i)++)
#define ll long long
#define mod 998244353
#define MOD 1000000007

using namespace std;

int gcd(int a,int b){
  if(b == 0) return a;
  else return gcd(b,a%b);
}

int main(){
  int n,ans;
  cin >> n;
  vector<int> a(n);
  for(int i=0;i < n;i++){
    cin >> a[i];
    if(i == 0) ans = a[i];
    else ans = gcd(ans,a[i]);
  }
  cout << ans << endl;
  return 0;
}
//#pragma GCC optimize(4)
#include<bits/stdc++.h>
#define FOR(i,a,b) for(int i=a;i<=b;++i)
#define REP(u) for(int i=p[u];i!=-1;i=e[i].nxt)
#define ll long long
#define ull unsigned long long
#define PII pair<int,int>
#define rd (rand()<<16^rand())
#define pb push_back
#define iter multiset<int>::iterator
using namespace std;
inline int gi()
{
	int x=0,f=1;
	char ch=getchar();
	while(ch<'0'||ch>'9')
	{
		if(ch=='-')f=-1;
		ch=getchar();
	}
	while(ch>='0'&&ch<='9')
	{
		x=(x<<3)+(x<<1)+(ch^48);
		ch=getchar();
	}
	return (f==1)?x:-x;
}
inline int max(int a,int b){return a>b?a:b;}
inline int min(int a,int b){return a<b?a:b;}
multiset<int>s;
int n,x;
int main()
{
	n=gi();
	FOR(i,1,n)
	{
		x=gi();
		s.insert(x);
	}
	while(s.size())
	{
		int x=*s.begin();
		iter it=s.end();
		--it;
		int y=*it;
		if(x==y)break;
		else {s.erase(y);s.insert(y-x);}
	}
	printf("%d\n",*s.begin());
	return 0;
}
