#include <iostream>

using namespace std;

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

int main() {
  int n;
  cin >> n;
  int x = 0;
  for (int i = 0; i < n; ++i) {
    int a;
    cin >> a;
    x = gcd(x, a);
  }
  cout << x;
}
#include <bits/stdc++.h>
using namespace std;

#define ff first
#define ss second
#define pb push_back
#define pf push_front
#define ppb pop_back()
#define ppf pop_front()
#define all(vec) vec.begin(), vec.end()
#define fol(i,a,b) for (int i = (a), _b = (b); i < _b; i++)
#define loop(i,a,b) for (int i = (a), _b = (b); i >= _b; i--)
#define forr(x,arr) for(auto &x : arr)
#define mod 1000000007
#define INF 0x3f3f3f3f3f3f3f3f
#define EPS 1e-7
#define sz(x) ((lli)(x).size())

template <class my>
using   vo      =   vector<my>;
using   lli     =   long long;
using   lld     =   long double;
using   ulli    =   unsigned long long int;
using   pll     =   pair<lli, lli>;
using   ttt     =   pair<lli, pll>;
using   vttt    =   vector<ttt>;
using   vll     =   vector<pll>;
using   vl      =   vector<lli>;
using   vi      =   vector<int>;
using   vvi     =   vector<vector<int>>;
using   cd      =   complex<lld>;
const double PI = acos(-1);

#ifndef tejasp
#define trace(...) {}
#define cotra(...) {}
#define end_routine() {}
#define localsys 0
#define endl '\n'
#endif

int white_horseman()
{
    lli n, m, k, q, u, v, temp = 0, ans = 0;
    cin >> n;
    int arr[n], val = 0;
    fol(i,0,n) cin >> arr[i];
    fol(i,0,n) val = __gcd(val, arr[i]);
    cout << val << endl;
    return 0;
}

signed main()
{
    #ifdef tejasp
            freopen("input.txt", "rt", stdin);
            freopen("output.txt", "wt", stdout);
    #endif
    ios_base::sync_with_stdio(false);   cin.tie(NULL);
    cout << fixed << setprecision(10);
    int t = 1;
    //cin >> t;
    fol(i,0,t) { 
        //cout << "Case #" << i + 1 << ": ";
        white_horseman(); 
    }
    //end_routine(); if(localsys) system("pause");
}