#include <iostream>
#include <algorithm>
#include <vector>
#include <queue>
#include <string>
#include <map>

#define amax(a, b) a = max(a, b)
#define amin(a, b) a = min(a, b)

using ll = long long;

using P = std::pair<ll, int>;
#define fi first
#define se second

int main() {
    int n;
    std::cin >> n;
    std::map<ll, int> cnt;
    for (int i=0; i<n; i++) {
        ll ai; std::cin >> ai;
        cnt[ai]++;
    }
    while (cnt.size() > 1) {
        ll x = cnt.begin()->fi;
        auto [X, X_cnt] = *(--cnt.end());
        cnt.erase(X);
        cnt[X-x] += X_cnt;
    }
    std::cout << cnt.begin()->fi << '\n';
    return 0;
}

#include<bits/stdc++.h>
using namespace std;
#define ll long long int
#define mx INT_MAX
#define mi INT_MIN
#define pb push_back
#define mp make_pair
#define YES cout<<"YES\n";
#define Yes cout<<"Yes\n";
#define NO cout<<"NO\n";
#define No cout<<"No\n";
#define all(v) (v).begin(),(v).end()
#define ff first
#define ss second
#define vi vector<int>
#define vpii vector< pair<int,int> >
#define si set<int>

ll md=1e9+7;

ll __gcd(ll a, ll b) {if(b==0) return a; return __gcd(b, a%b);}
ll poww(ll a, ll b) {ll res=1;while(b) {if(b&1){res*=a;res%=md;}a*=a;a%=md;b>>=1;}return res;}
void ainp(int arr[], int n) {for(int i=0;i<n;i++) cin>>arr[i];}

void fast()
{ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);}


void solve()
{
int n,i,m=INT_MAX,p=INT_MAX;
cin>>n;
int a[n];
for(i=0;i<n;i++)
{
	cin>>a[i];
	m=min(m,a[i]);
}
for(i=0;i<n;i++)
{
	a[i]=__gcd(m,a[i]);
	p=min(p,a[i]);
}
cout<<p;
}

int main()
{  
fast();
int t;
//cin>>t;
t=1;
while(t--)
{ 
solve();	
}
return 0;
}

