#include<bits/stdc++.h>
using namespace std;
int n,a[100010];
inline int read()
{
	int x=0,w=0;char ch=0;
	while(!isdigit(ch)){w|=ch=='-';ch=getchar();}
	while(isdigit(ch)){x=(x<<1)+(x<<3)+(ch^48);ch=getchar();}
	return w?-x:x;
}
int gcd(int N,int M)
{while(N^=M^=N^=M%=N);return M;}
int main()
{
	n=read();
	for(int i=1;i<=n;i++){
		a[i]=read();
		a[1]=gcd(a[1],a[i]);
	}
	cout<<a[1]<<'\n';
}
#include <bits/stdc++.h>
#define int long long
using namespace std;

const int N = 1e5 + 10;
int a[N]; int n;

int gcd(int x,int y){return (y==0) ? x : gcd(y,x%y);}

signed main() {
  scanf("%lld",&n);
  for(int i=1;i<=n;i++) scanf("%lld",&a[i]);
  int s = a[1]; for(int i=2;i<=n;i++) s = gcd(s,a[i]);
  printf("%lld\n",s);
}