var lines =[];

var readline = require("readline");
var rl = readline.createInterface({
  input:  process.stdin,
  output: process.stdout
});

rl.on('line',function(x){
  lines.push(x);
});

rl.on('close',function(){
  var a = [];
  var n = Number(lines[0].split(" "));
  var tmp = lines[1].split(" ");
  var result = 0;

  for(var i=0;i<n;i++){
    a[i]=Number(tmp[i]);
  }

  a.sort(function(a,b){return(a-b )});
  result = a[0];
  var result_before = 0;
  var damage = 0;
  var atack = a[0];

  while(1){
    result_before = result;
    for(var i=0;i<n;i++){
      damage = a[i]
      damage = damage%atack;
      if(damage < result && damage !== 0){result = damage;}
    }
    if(result < atack){atack = result;}
    if(result_before === result){break;}
  }
  console.log(result);
});
