#include <bits/stdc++.h>
using namespace std;
#define repr(i, a, b) for (int i = a; i < b; i++)
#define rep(i, n) for (int i = 0; i < n; i++)
typedef long long ll;
#define mod 1000000007

ll gcd(ll x,ll y) {return y ? gcd(y,x%y) : x;} 
ll lcm(ll x,ll y) {return x/gcd(x,y)*y;}

int main(){
    ll n,ans;
    cin >> n;
    vector<ll> a(n);
    rep(i,n) cin >> a[i];
    
    ans=a[0];
    
    rep(i,n){
        ans=gcd(ans,a[i]);
    }
    
    cout << ans << endl;

    return 0;
}










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

int main() {
  ios::sync_with_stdio(false);

  int N;
  cin >> N;

  vector<int> A(N);
  for (int i = 0; i < N; ++i) cin >> A[i];

  sort(A.begin(), A.end());
  A.erase(unique(A.begin(), A.end()), A.end());
  while (A.size() > 1) {
    int v = A[0];
    for (int i = 1; i < A.size(); ++i) {
      if (A[i] % A[0]) v = min(v, A[i] % A[0]);
      else A[i] = A[0];
    }
    if (v) A.push_back(v);
    sort(A.begin(), A.end());
    A.erase(unique(A.begin(), A.end()), A.end());
  }

  cout << A[0] << endl;
}

