#include <bits/stdc++.h>
typedef int integer;
#define int long long
#define pb push_back
#define mp make_pair
#define sz(x) (int) (x).size()
using namespace std;

integer main(){
    ios_base::sync_with_stdio(false);

    int n;
    cin >> n;
    int ar[n];
    for (int i = 0; i < n; i++){
        cin >> ar[i];
    }
    sort(ar, ar+n);
    int m = 1e15;
    for (int i = 1; i < n; i++){
        m = min(m, abs(ar[i] - ar[i-1]));
    }

    cout << m << endl;


}