#include <bits/stdc++.h>
#define MOD 1000000007
#define ll long long
#define ld long double
#define slld(t) scanf("%lld",&t)
#define sd(t) scanf("%d",&t)
#define sc(x) scanf("%s",x)
#define pd(t) printf("%d\n",t)
#define plld(t) printf("%lld\n",t)
#define mp(a,b) make_pair(a,b)
#define pii pair<int,int> 
#define pli pair<ll,int>
#define pil pair<int,ll>  
#define pll pair<ll,ll>
#define ff first
#define ss second
#define pb(x) push_back(x)
#define ub upper_bound
#define lb lower_bound
#define all(x) x.begin(),x.end()
#define sz(x) (int)x.size()
#define clr(x) memset(x,0,sizeof(x))
#define sws ios::sync_with_stdio(false); cin.tie(0); cout.tie(0)
#define pi acos(-1)
#define rep(I, N) for (ll I = 0; I < (N); ++I)
#define repp(I, a, B) for (ll I = (a); I <= (B); ++I)
#define t1(x)                cout<<#x<<": "<<x<<endl
#define t2(x, y)             cout<<#x<<": "<<x<<" | "<<#y<<": "<<y<<endl
#define t3(x, y, z)          cout<<#x<<": "<<x<<" | "<<#y<<": "<<y<<" | "<<#z<<": "<<z<<endl
#define t4(a, b, c, d)       cout<<#a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<endl
#define t5(a, b, c, d, e)    cout<<#a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<" | "<<#e<< ": "<<e<<endl
#define t6(a, b, c, d, e, f) cout<<#a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<" | "<<#e<< ": "<<e<<" | "<<#f<<": "<<f<<endl
using namespace std;
int months[13] = { 0, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 };
string itos(ll i) 
{
    string s = "";
    while (i)
    {
        s += char(i % 10 + '0');
        i /= 10; 
    }
    reverse(all(s));  
    return s; 
}
ll stoi(string &s) 
{
    ll tot = 0; 
    for (int i = (int)s.length() - 1, j = 1; i >= 0; i--, j *= 10) 
    {
        tot += j * (s[i] + '0'); 
    }  
    return tot; 
}
bool cmp(const pair<int,int> &a, const pair<int,int> &b)
{
    return (a.first > b.first);
}
/*const int maxn = 2e5 + 5;
ll fact[maxn];
ll invfact[maxn];
ll C(ll n, ll k) 
{
    return fact[n] * 1ll * invfact[n - k] % MOD * invfact[k] % MOD;
}
void Combpre()
{
    fact[0] = 1;
    for (long long i = 1; i < N; ++i) 
    {
        fact[i] = 1ll * i * fact[i - 1] ;
    }
    // for inverse MODulo : if (1/b)%MOD then ans is (b^(MOD-2))%MOD
    invfact[N - 1] = pwr(fact[N - 1], MOD - 2, MOD);
    for (long long i = N - 2; i >= 0; --i) 
    {
        invfact[i] = 1ll * invfact[i + 1] * (i + 1) % MOD;
    }
}
inline int add(int a,int b)
{
    a = a + b;
    if(a>=MOD)a -= MOD;
    return a;
}
inline int sub(int a,int b)
{
    a = a - b;
    if(a < 0)a += MOD;
    return a;
}
inline int mul(ll a,ll b)
{
    a = a * b % MOD;
    return a;
}*/
/*const int MaX = 2e6 + 5;
bool isPrime[MaX];
void sieve(int n) 
{
    for(int i = 0; i <= n;++i) 
    {
        isPrime[i] = true;
    }
    isPrime[0] = false;
    isPrime[1] = false;
    for(int i = 2; i * i <= n; ++i) 
    {
         if(isPrime[i] == true) 
         {
             for(int j = i * i; j <= n ;j += i)
                 isPrime[j] = false;
        }
    }
}*/
ll pwr(ll base, ll p, ll mod = MOD)
{
    ll ans = 1;
    while(p)
    {
        if(p & 1) ans = (ans * base) % MOD;
        base = (base * base) % MOD;
        p /= 2;
    }
    return ans;
}
ll gcd(ll a, ll b)
{
    if(b == 0)  return a;
     return gcd(b, a%b);
}
ll lcm(ll a, ll b)
{
    return (a*b*1LL) / gcd(a, b);
    /* LCM for big numbers
    if(max(a,b) % min(a,b) == 0) LCM = max(a,b);
    else { LCM = lcm(a,b);if(LCM % w == 0 && LCM % b == 0) f = 1;
        if(!f || LCM < 0) LCM overflows}*/
}

const int N = 2e5 + 5 ;
const int LN = 30;


//


int main()
{
    sws;
    srand(time(NULL));
    cout << fixed << setprecision(10);
    clock_t clk;
    clk = clock();
    

    //freopen("input.txt", "r", stdin); freopen("output.txt", "w", stdout);


    int n;
    cin >> n;
    vector<int> v;
    repp(i,1,n+1)
    {
        int num;
        cin >> num;
        v.pb(num);
    }
    sort(all(v));
    int g = 0;
    rep(i,n)
    {
        int dif = v[i + 1] - v[i]; //t1(dif);
        g = gcd(g, dif);
    }
    cout << g;


    clk = clock() - clk;
    cerr << fixed << setprecision(6) << "Time: " << ((double)clk)/CLOCKS_PER_SEC << "\n";
    
    return 0;
}


Measured memory_bytes: 892