#include <fstream>
using namespace std;
ifstream f1("dquc.inp");
ofstream f2("dquc.out");
long long i,a[100000];
long long uc(long long a,long long b)
{
    if (a != b)
    {
        if (a > b) a = a - b;
        else b = b - a;
        uc(a,b);
    }
    return a;
}
int main()
{
    f1 >> i;
    for (long n = 0; n < i; n++)f1 >> a[n];
    for (long n = i-1; n >= 0; n--)
    {
        for (long m = 0; m < n; m++)
        {
            a[m] = uc(a[m],a[m+1]);
        }
    }
    f2 << a[0];
    return 0;
}
