#include <bits/stdc++.h>

using namespace std;

int ucln(int x, int y){
 if (x==y){return x;}
 else if (x==1||y==1){return 1;}
 else {
    if (x>y){return ucln(x-y,y);}
    if (x<y){return ucln(x,y-x);}
 }
}

int main(){
 int n;
 cin>>n;
 int a[n],i;
 for (i=0;i<n;i++){cin>>a[i];}
 for (i=1;i<n;i++){
    a[i]=ucln(a[i],a[i-1]);
 }
 cout<<a[n-1];
}
