#include <stdio.h>
int gcd(int a,int b){return b==0?a:gcd(b,a%b);}
int main(){
int n,ans,temp;
  scanf("%d%d",&n,&ans);
  n--;
  while(n--){
  scanf("%d",&temp);
    ans=gcd(ans,temp);
  } 
  printf("%d\n",ans);
}