#include <fstream>
#include <vector>
#include <cstdint>
using namespace std;

ifstream input("REMAIN.inp");
ofstream output("REMAIN.out");

int main()
{
	int n;
	long long max = INT64_MIN, min = INT64_MAX;
	long long res;
	input >> n;
	vector <long long> a(n);
	vector <long long> temp;
	for (int i = 0; i < n; ++i)
	{
		input >> a[i];
		if (a[i] > max)
		{
			max = a[i];
		}
		if (a[i] < min)
		{
			min = a[i];
		}
	}
	long long d = max - min;
	for (int i = 1; i * i <= d; ++i)
	{
		if (d % i == 0)
		{
			temp.push_back(i);
			if (i != d / i)
			{
				temp.push_back(d / i);
			}
		}
	}
	for (int i = 0; i < temp.size(); ++i)
	{
		if (d % temp[i] == 0)
		{
			bool br = false;
			long long tmp = a[0] % temp[i];
			for (int j = 1; j < n; j++)
			{
				if (a[j] % temp[i] != tmp)
				{
					br = true;
					break;
				}
			}
			if (!br)
			{
				res = i;
			}
		}
	}
	output << res;
	input.close();
	output.close();
	return 0;
}