#include <bits/stdc++.h>
#define rep(a,n) for (ll a = 0; a < (n); ++a)
using namespace std;
//using namespace atcoder;
using ll = long long;
typedef pair<ll,ll> P;
typedef pair<ll,P> PP;
typedef vector<vector<int> > Graph;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
const ll INF = 1e18;

#define debug(v) cout<<#v<<": ",prt(v);
template <typename A,typename B>
inline void prt(pair<A,B> p){cout<<"("<<p.first<<", "<<p.second<<")\n";}
template <typename A,typename B,typename C>
inline void prt(tuple<A,B,C> p){cout<<"("<<get<0>(p)<<", "<<get<1>(p)<<", "<<get<2>(p)<<")\n";}
inline void prt(bool p){if(p)cout<<"True"<<'\n';else cout<<"False"<<'\n';}
template <typename T> 
inline void prt(vector<T> v){cout<<'{';for(ll i=0;i<v.size();i++){cout<<v[i];if(i<v.size()-1)cout<<", ";}cout<<'}'<<'\n';}
template<typename T> 
inline void prt(vector<vector<T> >& vv){ for(const auto& v : vv){ prt(v); } }
template <typename T> 
inline void prt(deque<T> v){cout<<'{';for(ll i=0;i<v.size();i++){cout<<v[i];if(i<v.size()-1)cout<<", ";}cout<<'}'<<'\n';}
template <typename A,typename B>
inline void prt(map<A,B> v){cout<<'{';ll c=0;for(auto &p: v){cout<<p.first<<":"<<p.second;c++;if(c!=v.size())cout<<", ";}cout<<'}'<<'\n';}
template <typename A,typename B>
inline void prt(unordered_map<A,B> v){cout<<'{';ll c=0;for(auto &p: v){cout<<p.first<<":"<<p.second;c++;if(c!=v.size())cout<<", ";}cout<<'}'<<'\n';}
template <typename T> 
inline void prt(set<T> v){cout<<'{';for(auto i=v.begin();i!=v.end();i++){cout<<*i;if(i!=--v.end())cout<<", ";}cout<<'}'<<'\n';}
template <typename T> 
inline void prt(multiset<T> v){cout<<'{';for(auto i=v.begin();i!=v.end();i++){cout<<*i;if(i!=--v.end())cout<<", ";}cout<<'}'<<'\n';}


int main(){
    ll n;
    cin >> n;
    vector<ll>a(n);
    rep(i,n)cin>>a[i];
    sort(a.begin(),a.end());
    ll x = a[0];
    set<ll>st;
    rep(i,n)st.insert(a[i]);
    ll X = *st.rbegin();
    while(X!=x){
        st.erase(X);
        ll nx = X-x;
        st.insert(nx);
        X = *st.rbegin();
        chmin(x,nx);
    }
    cout << X << endl;
    return 0;
}
#include <bits/stdc++.h>
#define pb push_back
#define mp make_pair
#define fir first
#define sec second
#define all(x) (x).begin(), (x).end()
typedef long long ll;

using namespace std;
//srand (time(NULL));
//rand()%10 //random 1-9
int arr[200005] = {0};
//queue<pair<int,int> pq;
//bool done = false;
//bool vis[105][105] = {0};
//int memo[105][105] = {0};
//vector<int> v;
//pair<int,int> arr;
int mov[2][4] = {{1 ,-1, 0, 0},
				 {0 , 0, 1,-1}};

int MOD = 1e9+7;

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

void solve()
{
	int n,tmpgcd;
	cin >> n;
	cin >> tmpgcd;
	for(int i=2;i<=n;i++)
	{
		int tmp;
		cin >> tmp;
		tmpgcd = gcd(tmpgcd,tmp);
	}
	cout << tmpgcd << endl;
}

int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);
    int tc=1;
	//cin>>tc;
	while(tc--)
	{
		solve();
	}
 	return 0;
}


