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

int main() {
    int N, max = 0;
    bool sin = true;
    cin >> N;
    int a[N];
    for (int i=0; i<N; i++){
        cin >> a[i];
        if (max < a[i])
            max = a[i];
        if (i>0 && a[i-1] != a[i])
            sin = false;
    }
    
    if (sin){
        cout << a[0] << endl;
        return 0;
    }
    
    int k = max / 2;
    int count = 0;
    while(true){
        for (int i=0; i<N; i++){
            if (a[i] % k != 0){
                count += 1;
                break;
            }
        }
        if (count == 0){
            cout << k << endl;
            return 0;
        }
        k -= 1;
        count = 0;
    }
}
#include <bits/stdc++.h>
using namespace std;
#define F first
#define S second

typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef pair<int, int> pii;
typedef vector<pii> vpii;
//mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
//(double)clock() / CLOCKS_PER_SEC;

int main()
{
    ios::sync_with_stdio(false);
    cin.tie(0);
    int n;
    cin>>n;
    set<int> s;
    for(int i=1; i<=n; i++)
    {
        int x;
        cin>>x;
        s.insert(x);
    }
    while(s.size()>1)
    {
        auto it=s.end();
        it--;
        int v=(*it);
        int mini=*(s.begin());
        s.erase(v);
        s.insert(v-mini);
    }
    cout<<(*s.begin())<<endl;
    return 0;
}
