output_description: Print the minimum possible final health of the last monster alive.
  
  * * *
input_description: Input is given from Standard Input in the following format:
  
      
      
      N
      A_1 A_2 ... A_N
attempt: #include <iostream>
  #include <algorithm>
  #include <vector> //動的配列
  #include <string>
  #include <list> //双方向リスト
  #include <map> //連想配列
  #include <set> //集合
  #include <stack>
  #include <queue>
  #include <deque>
  #include <cmath>
  #include <bitset>
  #include <numeric>
  #include <tuple>
  
  
  
  typedef long long ll;
  
  
  using namespace std;
  
  typedef pair<int, int> P;
  #define FOR(i,a,b) for(int i=(int)(a) ; i < (int) (b) ; ++i )
  #define rep(i,n) FOR(i,0,n)
  #define sz(x) int(x.size())
  
  
  template <class T>ostream &operator<<(ostream &o,const vector<T>&v)
  {o<<"{";for(int i=0;i<(int)v.size();i++)o<<(i>0?", ":"")<<v[i];o<<"}";return o;}
  
  // n次元配列の初期化。第２引数の型のサイズごとに初期化していく。
  template<typename A, size_t N, typename T>
  void Fill(A (&array)[N], const T &val){
      std::fill( (T*)array, (T*)(array+N), val );
  }
  
  //小さい順から取り出すヒープ
  //priority_queue<ll, vector<ll>, greater<ll> > pque1;
  
  int gcd(int a,int b){
      if (a==0) return b;
      else return gcd(b%a,a);
  }
  int inf=1001001001;
  
  int main(){
      int n;
      cin>>n;
      vector<int> v(n);
      rep(i,n) {
          int a;
          cin>>a;
          v[i]=a;
      }
      sort(v.begin(),v.end());
      int tmp=gcd(v[0],v[1]);
      //cout<<tmp<<endl;
      //int ans=inf;
      for (int i=2;i<n;i++){
          tmp=gcd(tmp,v[i]);
      }
      cout<<tmp;
      return 0;
  }
problem_description: Statement
  
  There are N monsters, numbered 1, 2, ..., N.
  
  Initially, the health of Monster i is A_i.
  
  Below, a monster with at least 1 health is called alive.
  
  Until there is only one alive monster, the following is repeated:
  
    * A random alive monster attacks another random alive monster.
    * As a result, the health of the monster attacked is reduced by the amount equal to the current health of the monster attacking.
  
  Find the minimum possible final health of the last monster alive.
samples: [{"input": "4\n    2 10 8 40", "output": "2\n    \n\nWhen only the first monster keeps on attacking, the final health of the last\nmonster will be 2, which is minimum.\n\n* * *"}, {"input": "4\n    5 13 8 1000000000", "output": "1\n    \n\n* * *"}, {"input": "3\n    1000000000 1000000000 1000000000", "output": "1000000000"}]