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

int main() {
    ios::sync_with_stdio(0);
    cin.tie(NULL), cout.tie(NULL);

    int n;
    cin >> n;

    int ans = 0;

    while (n--)
    {
        int x;
        cin >> x;

        ans = __gcd(x, ans);
    }

    cout << ans << "\n";
    return 0;
}

#include <bits/stdc++.h>
using namespace std;
typedef vector<int> vi;
typedef vector<vector<int>> vvi;
typedef pair<int,int> pii;
typedef long long ll;
const long long MOD=1000000007;
#define rep(i,n) for(ll i=0;i<(n);i++)
#define rep2(i,m,n) for(ll i=(m);i<(n);i++)
#define ALL(v) v.begin(), v.end()
#define pb push_back


ll gcd(ll a, ll b){
    ll bigger=max(a,b);
    ll smaller=min(a,b);

    if (bigger%smaller==0){
        return smaller;
    }
    else {
        return gcd(smaller,bigger%smaller);
    }
}





int main(){

    ll n;
    cin>>n;

    vector<ll> data(n);

    rep(i,n){
        int tmp;
        cin>>tmp;
        data.at(i)=tmp;
    }
  
  ll answer;

    if (n>=2){
    
    


     answer=gcd(data.at(0),data.at(1));

    for (int i=1;i<=n-2;i++){
        answer=gcd(answer,data.at(i+1));
    }

    }

    else {
        answer=data.at(0);
    }

    cout<<answer<<endl;





}