#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>

using namespace __gnu_pbds;
using namespace std;

#define ll long long
#define all(x) x.begin(),x.end()

typedef tree<
    int,
    null_type,
    greater<int>,
    rb_tree_tag,
    tree_order_statistics_node_update
> ordered_set;

ll MOD = 1000000007;

ll oo = 1e15;

ll const N = 200000;

ll dp[N][4];

string s;

ll go(ll idx,ll mod) {
    //base case
    if (idx==s.size()) return mod==0;
    //dp check
    ll & res = dp[idx][mod];
    if (~res) return res;
    //transition
    ll dig = s[idx]-'0';
    ll gain1 = ((mod+dig)%3)==0;
    ll ch1 = go(idx+1,3) + gain1;
    ll ch2 = go(idx+1,(mod+dig)%3);
    return res = max(ch1,ch2);
}

void solve() {
    ll n;cin>>n;
    ll a[n];
    for (ll i=0;i<n;i++)cin>>a[i];
    ll diff[n];
    ll ans = 0;
    for (ll i=0;i<n-1;i++) {
        diff[i] = abs(a[i+1]-a[i]);
        ans = __gcd(ans,diff[i]);
    }
    cout<<ans<<endl;
}

signed main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
#ifndef ONLINE_JUDGE
    freopen("input.txt", "r",stdin);
    freopen("output.txt", "w",stdout);
#endif
    bool calc = false;
    // calc = true;
    if (calc) {
        cout << N*2*2*4 << endl;
        cout << (1ll << (17)) << endl;
        return 0;
    }
    ll t = 1;
    // cin >> t;
    while (t--) {
        solve();
    }
}
