
#pragma region HEAD
#define REP(i, n) for (int i = 0; i < (int)(n); i++)
#define EMIT(s) std::cout << (s) << std::endl
#define ANSWER(b) EMIT((b) ? "Yes" : "No")
#define SCREAM(b) EMIT((b) ? "YES" : "NO")
#define WHISPR(b) EMIT((b) ? "yes" : "no")
#include <iostream>
#include <fstream>
#include <vector>
#include <set>
using namespace std;
using ll = long long;

int solve();

int main()
{
#ifdef DEBUG_MODE
  ifstream in("input.dat");
  cin.rdbuf(in.rdbuf());
#else
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
#endif
  solve();
  return 0;
}
#pragma endregion

int solve()
{
  int n;
  cin>>n;
  vector<ll> an(n);
  REP(i,n){
    cin>>an[i];
  }
  set<ll> s;
  REP(i,n){
    s.insert(an[i]);
  }
  while(s.size()>1){
    auto maxi = *s.rbegin();
    auto mini = *s.begin();
    s.erase(maxi);
    s.insert(maxi-mini);
  }
  cout<<*s.begin()<<endl;
  return 0;
}

#include<bits/stdc++.h>
#define int long long int
using namespace std;
#define md 1000000007

    
int32_t main()
{
   int n;
   cin>>n;
   int a[n];
   multiset<int>s;
   for(int i=0;i<n;i++){cin>>a[i];s.insert(a[i]);}
   int ans=a[0];
   for(int i=1;i<n;i++)ans=__gcd(ans,a[i]);
   cout<<ans<<endl;

   

}


