#include<bits/stdc++.h>
using namespace std;
#define int long long
#define ll long long
#define cs const 
#define fr first 
#define se second
//#define ls (now<<1)
//#define rs (now<<1|1)
#define mid ((l+r)>>1)
#define Mid ((l + r) / 2)
#define mp make_pair
#define pb push_back
#define ppb pop_back
#define low(i) (i&(-i))
#define par pair<int,int>
#define cn(x) memset(x, 0, sizeof(x))
#define rep(i, x, y) for(int i=x; i<=y; ++i)
#define sep(i, x, y) for(int i=x; i>=y; --i)
#define fore(i, x) for(int i=fir[x]; i; i=nex[i])

cs int G = 3;
cs int ff = 1e6 + 1;
cs ll inf = 1e17 + 1;
cs int M = 1e9 + 7;
cs double eps = 1e-7;
cs int mod = 998244353;
inline int read() { int x; scanf("%lld", &x); return x; }

int fir[ff], nex[ff], to[ff], tot, va[ff];
void add(int x, int y, ll z) { nex[++tot] = fir[x]; fir[x] = tot; to[tot] = y; va[tot] = z; }
void ade(int x, int y, ll z) { add(x, y, z); add(y, x, z); } 


int n, s, a[ff], Ans;
int gcd(int x, int y) { return(y ? gcd(y, x % y) : x); }
void init()
{
	cin >> n;
	rep(i, 1, n) cin >> a[i], Ans = gcd(Ans, a[i]);
	cout << Ans;
}
signed main()
{
	int Ts = 1;
//	cin >> Ts;
	while(Ts--)
		init();
}
/*
3 2 9
1 2 0
2 3 0
2 1 2
1 3
1 2
2 1 1
1 3
1 2
2 2 1 2
1 3
1 2
*/
#include<bits/stdc++.h>
#define ll long long 
#define inf 0x7fffffff
#define infll 0x7fffffffffffffff
#define clr(c) memset(c,0,sizeof(c))
using namespace std;
int mod=998244353;
const int M=2e5+10;
const int N=1e6+10;
inline ll read(){
    ll b=1,sum=0; char c=getchar();
    while(!isdigit(c)){if(c=='-') b=-1; c=getchar();}
    while(isdigit(c)){sum=sum*10+c-'0'; c=getchar();}
    return b*sum;
}
int T,n,m,k;
int ans;
ll a[N];
ll gcd(ll x, ll y) {
	return y?gcd(y,x%y):x;
}
bool cmp(int x,int y){ return x<y; }
int main()
{
    int i,j;
	n=read();
	for(i=1;i<=n;i++) {
		a[i]=read();
	}
	ll x=a[1];
	for(i=2;i<=n;i++){
		x=gcd(x,a[i]);
	}
	printf("%lld",x);
    return 0;
}
