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

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

int main()
{
	int n;
	int max = INT32_MIN, min = INT32_MAX;
	int res;
	input >> n;
	vector <int> a(n);
	for (int i = 0; i < n; ++i)
	{
		input >> a[i];
		if (a[i] > max)
		{
			max = a[i];
		}
		if (a[i] < min)
		{
			min = a[i];
		}
	}
	for (int i = max - min; i >= 1; --i)
	{
		bool br = false;
		int temp = a[0] % i;
		for (int j = 1; j < n; j++)
		{
			if (a[j] % i != temp)
			{
				br = true;
				break;
			}
		}
		if (!br)
		{
			res = i;
			break;
		}
	}
	output << res;
	input.close();
	output.close();
	return 0;
}