#include"bits/stdc++.h"
using namespace std;
using ll=long long;
template<class T=ll>inline T in(istream&is=cin){T ret;is>>ret;return ret;}
template<class T,class Size=typename vector<T>::size_type>inline auto vector_2d(Size h,Size w,T v){return vector<vector<T>>(h,vector<T>(w,v));}
template<class RandomAccessIterator,class Pair=typename iterator_traits<RandomAccessIterator>::value_type>inline void sort_pairs_by_second(RandomAccessIterator first,RandomAccessIterator last){sort(first,last,[](const Pair&p1,const Pair&p2){return p1.second<p2.second||(p1.second==p2.second&&p1.first<p2.first);});}

int main()
{
    ll n=in();
    map<ll,ll>cnt;
    for(ll i=0;i<n;++i){
        ++cnt[in()];
    }
    while(cnt.size()!=1){
        cnt[cnt.rbegin()->first-cnt.begin()->first]+=cnt.rbegin()->second;
        //cnt.erase(cnt.rbegin());
        cnt.erase(prev(cnt.end()));
    }
    cout<<cnt.begin()->first<<endl;
}

#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <functional>
#include <cmath>
#include <map>
#define rep(i,n) for (int i=0;i<n;i++)

#define DENOM 1000000007

using namespace std;
using ll = long long;

int main(){
  string s ;
  cin >> s ;
  size_t n = s.size() ;
  size_t j ;
  for (j=0;j<n;++j) {
    if (s[j] == '.')
      break ;
  }
  cout << s.substr(0, j) << endl ;
  return 0 ;
}
