#include <bits/stdc++.h>

using namespace std;
typedef long long ll;
const ll MOD = 1e9 + 7;

int main() {
    ll N = 0;
    cin >> N;
    set<ll> A;
    ll t;
    ll x = 1000000000000;
    for(ll i = 0; i < N; i++) {
        cin >> t;
        A.insert(t);
        x = min(x, t);
    }
    while(A.size() != 1) {
        set<ll> ans;
        ans.clear();
        for (set<ll>::iterator it = A.begin(); it != A.end(); it++) {
            ans.insert((*it)%x + x);
            //cout << *it << endl;
        }
        ll memo = x;
        for (set<ll>::iterator it = ans.begin(); it != ans.end(); it++) {
            
            if(*it != memo)x = min(x, *it - memo);
        }
        A.clear();
        A = ans;
        //cout << "##" << endl;
    }
    cout << x << endl;



    return 0;
}
#include<iostream>
#include<bits/stdc++.h>
#include<climits>

#define PI 3.14159265358979323846264338327950L
#define ll long long
#define db double

using namespace std;

const int MOD = 1e9+7;

void go(){
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout<<fixed;
  cout<<setprecision(20);

  #ifndef ONLINE_JUDGE
       freopen("input.txt","r",stdin);
       freopen("output.txt","w",stdout);
  #endif
}

void solve(){
    int n; cin>>n;
    int arr[n];
    for(int i = 0; i < n; i++) cin>>arr[i];
    sort(arr,arr+n);
    int sol = 0;
    for(int i = 0; i < n; i++){
        sol = __gcd(sol,arr[i]);
    }
    cout<<sol<<endl;
}  

int main(){
    go(); 

    // code here
    int t = 1; 
    while(t--) solve();
   
}




