#include<bits/stdc++.h>
#define rep(i,a,n) for (int i=a;i<n;i++)
#define per(i,a,n) for (int i=n-1;i>=a;i--)
#define repk(i,a,n) for(int i=a;i<=(n);i++)
#define pb push_back
#define ppb pop_back
#define all(k) k.begin(),k.end()
#define eb emplace_back
#define mp make_pair
#define ll  long long
#define pl pair<ll,ll>
#define vc vector<char>
#define vl vector<ll>
#define vvl vector<vl>
#define vi vector<int>
#define vvi vector<vi>
#define vc vector<char>
#define vpi vector<pi>
#define vpl vector<pl>
#define vvc vector<vc>
#define mi map<int,int>
#define ml map<ll,ll>
template<typename T, typename U> inline bool mn(T& m, U x) { if (m > x) { m = x; return true; } return false; }
#define umap unordered_map<int,int>
using namespace std;



void sol() {
	int n; cin >> n;
	vl ar(n);
	rep(i, 0, n)cin >> ar[i];
	ll cnt = -1, res = *min_element(all(ar));
	while (cnt != res) {
		cnt = res;
		rep(i, 0, n) {
			if (!(ar[i] % res))mn(res, res);
			else
				mn(res, ar[i] % res);

		}
	}


	cout << res;
}
int main() {
	int t = 1; //cin >> t;
	while (t--)sol();

	return 0;
}
#include <iostream>
#include <vector>
#include <algorithm>

int main() {
    int N;
    long T, T1 = 0, T2 = 0;
    std::string S, S1, S2;

    std::cin >> N;
    
    while(N--) {
        std::cin >> S >> T;
        if(T > T1) {
            T2 = T1;
            S2 = S1;
            T1 = T;
            S1 = S;
        } else {
            if(T > T2) {
                T2 = T;
                S2 = S;
            }
        }
    }
    std::cout << S2 << std::endl;
}