#include<iostream>
#include<algorithm>
#include<functional>
#include<cmath>
#include<string>
#include<vector>
#include<stack>
#include<queue>
#include<map>
#include<set>
#include<deque>
using namespace std;
#define ll long long
const int mod = 1000000007;
const int MOD = 998244353;
const ll INF = 1000000000000000000;

int gcd(int x, int y) {
	if (x < y) gcd(y, x);
	if (y == 0) return x;
	return gcd(y, x % y);
}
int A[100010];
int main()
{
	int N;
	cin >> N;
	for (int i = 0; i < N; i++) cin >> A[i];
	int ans = 0;
	for (int i = 0; i < N; i++) ans = gcd(ans, A[i]);
	cout << ans << endl;
}
#include <bits/stdc++.h> 

using namespace std;

const int N = 1e5 + 10;

int n, a, ans;

int main() {
	cin >> n >> ans;
	for(int i = 1; i < n; ++i)		cin >> a, ans = __gcd(ans, a);
	cout << ans << endl;
	return 0;
}