#include<bits/stdc++.h>
#define pb push_back
#define Int long long
using namespace std;

Int N,M,K;
Int h,w;
Int X,Y,Z;
const int MAXN=500005;
const int NAX=1005;
const int HIGH=1e8+500;

int main()
{
	#ifndef ONLINE_JUDGE
	freopen("inputf.txt","r",stdin);
	freopen("outputf.txt","w",stdout);
	#endif
	
	cin>>N;
	vector<Int> A(N);
	Int GCD=0;
	for(auto &x:A) {
		cin>>x;
		GCD=__gcd(GCD,x);
	}

	cout<<GCD<<'\n';
	

}
#include <stdio.h>

int gcd(int a, int b) {
    if (!a)
        return b;
    return gcd(b % a, a);
}

int main() {
    int n, a, b;
    scanf("%i%i", &n, &a);
    for (int i = 1; i < n; i++) {
        scanf("%i", &b);
        a = gcd(a, b);
    }
    printf("%i", a);
}
