#include<bits/stdc++.h>
//#include <atcoder/all>
#define rep(i, n) for(int i = 0; i < (n); ++i)
//#define DEBUG
#ifdef DEBUG
#define DEBUG_PRINT(fm, ...) do{std::printf("%s:%d(%s)", __FILE__, __LINE__, __func__);std::cout << "DEBUG PRINT ";std::printf(fm, __VA_ARGS__);}while(0)
#define DEBUG_VAL(a, b) do{std::printf("%s:%d(%s)", __FILE__, __LINE__, __func__);std::cout <<"DEBUG VAL " << a << ":" << b << endl;}while(0)
#else
#define DEBUG_PRINT(...)do{}while(0);
#define DEBUG_VAL(a, b)do{}while(0);
#endif

using namespace std;
//using namespace atcoder;
using ll = long long;
using v1 = vector<int>;
using vl = vector<long long>;
using v2 = vector<vector<int>>;
using v3 = vector<vector<char>>;
ll gcd(ll x,ll y){
    if(x<y) swap(x,y);
    ll r;
    while(y>0){
        r=x%y;
        x=y;
        y=r;
    }
    return x;
}
int main(){
    int n;
    cin >> n;
    vl A(n);
    rep(i, n){
      cin >> A[i];
    }
    ll ans = gcd(A[0], A[1]);
    for(int i = 2; i < n;i++){
        ans = gcd(ans, A[i]);
    }
    cout << ans << endl;
}

#include<bits/stdc++.h>
using namespace std;
 
int gcd(int a, int b) {return b?gcd(b, a%b):a;}
int main() {
int n; cin >> n;
  vector<int> a(n);
  for (int i=0;i<n;i++) cin >> a[i];
  int ans = a[0];
  for (int i=0;i<n;i++) ans = gcd(ans,a[i]);
  cout << ans << endl;
  return 0;
}