#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0;i<n;i++)
int main(){
  long n,m;cin>>n;
  set<long> s;
  rep(i,n){cin>>m; s.insert(m);}
  
  //cout<<*rbegin(s)<<endl;
  
  while(1){
    if(*rbegin(s)==*begin(s)||s.size()==1){cout<<*rbegin(s);break;}
    else {
      //if(s.size()==1){cout<<*begin(s);return 0;}
       s.insert(*rbegin(s)-*begin(s)); s.erase(*rbegin(s));  /*cout<<*rbegin(s)-*begin(s)<<endl;*/ }
   
  }

}
#include <bits/stdc++.h>
using namespace std;
#define rep(i, c) for (int i = 0; i < (int)c; i++)
using ll = long long;
ll GCD(ll a, ll b) {
    if (b == 0)
        return a;
    else
        return GCD(b, a % b);
}

int main() {
    int n;
    cin >> n;
    ll res = 0;
    rep(i, n) {
        ll a;
        cin >> a;
        res = GCD(res, a);
    }
    cout << res << endl;
}