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];

  // モンスターiが攻撃
  for(var i=0;i<n;i++){
    for(var k=0;k<n;k++){
      if(i!==k){
        var damage = a[k];
        damage = damage%a[i];
        for(var j=0;j<n;j++){
          damage = a[j]%damage;
          if(damage < result && damage !== 0){result = damage;}
        }
      }
    }
  }

  console.log(result);


});
