#include <iostream>
#include <vector>
#include <algorithm>
#include <map>
#include <iomanip>
#include <ios>

using namespace std;

//skip
void C111()
{
  int n;
  cin >> n;
  vector<int> v(n);
  for (int i = 0; i < n; ++i) cin >> v[i];
}


void pyramid()
{
  int n;
  cin >> n;
  vector<int> x(n), y(n), h(n);
  int x1, y1, h1;
  for (int i = 0; i < n; ++i)
  {
    cin >> x[i] >> y[i] >> h[i];
    if (h[i] >= 1)
    {
      x1 = x[i];
      y1 = y[i];
      h1 = h[i];
    }
  }

  for (int i = 0; i <= 100; ++i)
  {
    for (int j = 0; j <= 100; ++j)
    {
      int h_max = max(0, h1 + abs(i - x1) + abs(j - y1));
      int exist_ans = 1;
      for (int k = 0; k < n; ++k)
      {
        if (h[k] != max(0, h_max - abs(i - x[k]) - abs(j - y[k])))
        {
          exist_ans = 0;
          break;
        }
      }
      if (exist_ans)
      {
        cout << i << " " << j << " " << h_max << "\n";
        return;
      }
    }
  }
}


void id_113()
{
  int n, m;
  cin >> n >> m;
  
  vector<vector<pair<int, int>>> py(n);
  for (int i = 0; i < m; ++i)
  {
    int p, y;
    cin >> p >> y;

    py[p - 1].push_back(make_pair(y, i));
  }

  for (int i = 0; i < n; ++i) sort(py[i].begin(), py[i].end());

  map<int, pair<int, int>> ans;
  for (int i = 0; i < n; ++i)
  {
    for (int j = 0; j < py[i].size(); ++j)
    {
      ans[py[i][j].second] = make_pair(i + 1, j + 1);
    }
  }
  
  for (int i = 0; i < m; ++i)
  {
    cout << setfill('0') << right << setw(6) << ans[i].first;
    cout << setfill('0') << right << setw(6) << ans[i].second << "\n";
  }
}


void C_755()
{
  int n;
  cin >> n;

  for (int i = 1; i <= n; ++i)
  {
    //string s = (string)n;
  }
}


void christmas_eve()
{
  int n, k;
  cin >> n >> k;
  vector<int> h(n);
  for (int i = 0; i < n; ++i) cin >> h[i];

  sort(h.begin(), h.end());

  int h_diff = 1000000000;
  for (int i = 0; i < n - k + 1; ++i)
  {
    h_diff = min(h_diff, h[i + k - 1] - h[i]);
  }

  cout << h_diff << "\n";
}


void grand_garden()
{
  int n;
  cin >> n;
  vector<int> h(n);
  for (int i = 0; i < n; ++i) cin >> h[i];

  int ans = 0, pre_flower = 0;
  for (int i = 0; i < n; ++i)
  {
    if (h[i] > pre_flower) ans += h[i] - pre_flower;
    pre_flower = h[i];
  }
  cout << ans << "\n";
}


void streamline()
{
  int n, m;
  cin >> n >> m;
  vector<int> x(m);
  for (int i = 0; i < m; ++i) cin >> x[i];

  if (m == 1 || !(n < m)) {
    cout << 0 << "\n";
    return;
  }

  sort(x.begin(), x.end());

  vector<int> l(m);
  int s = 0;
  for (int i = 1; i < m; ++i)
  {
    l[i] = x[i] - x[i - 1];
    s += l[i];
  }

  sort(l.begin(), l.end(), greater<>());

  int ans = s;
  for (int i = 0; i < n - 1; ++i)
  {
    ans -= l[i];
  }
  cout << ans << "\n";
}


long long int gcd(int a, int b)
{
  if (a < b)
  {
    int tmp;
    tmp = a;
    a = b;
    b = tmp;
  }

  int r = a % b;
  while (r != 0)
  {
    a = b;
    b = r;
    r = a % b;
  }

  return b;
}


void monsters_battle_royale()
{
  int n, ans;
  cin >> n;
  cin >> ans;

  for (int i = 1; i < n; ++i)
  {
    int a;
    cin >> a;
    ans = gcd(ans, a);
  }
  cout << ans << "\n";
}



int main()
{
  //C111();
  //pyramid();
  //id_113();
  //C_755();
  //christmas_eve();
  //grand_garden();
  //streamline();
  monsters_battle_royale();
}


Measured memory_bytes: 256