#include <fstream>
using namespace std;
ifstream f1("remain.inp");
ofstream f2("remain.out");
long n,a[100000],kq = 1;
bool kt(long i)
{
    for (long j = 1; j < n; j++)
    {
        if (a[j]%i != a[j-1]%i) return 0;
    }
    return 1;
}
int main()
{
    f1 >> n;
    for (long i = 0; i < n; i++) f1 >> a[i];
    while (kt(kq) == 1) kq++;
    f2 << kq-1;
    return 0;
}
