"use strict";

// read lines from stdin
const input = require("fs")
  .readFileSync("/dev/stdin", "utf8")
  .split("\n");

const N = parseInt(input[0], 10);

let A = input[1]
  .split(" ")
  .slice(0, N)
  .map(val => parseInt(val, 10))
  .sort((a, b) => b - a);

while (A[1]) {
  A[0] = A[0] % A[1];

  if (A[0] === 0) {
    A.shift();
  } else {
    const insertion = A.findIndex((val) => val < A[0]);
    if (insertion === -1) { A.push(A[0]); A.shift(); }
    else { A = A.slice(1, insertion).concat(A[0], A.slice(insertion)); }
  }
}

console.log(A[0]);
