#include #include #include #include #include #include #include #include #define rep(i, n) for (int i = 0; i < n; ++i) #define FOR(i, a, b) for (int i = a; i < b; ++i) #define RFOR(i, a, b) for (int i = a; i > b; --i) #define ll long long #define all(a) a.begin(), a.end() #define ull unsigned long long #define pb(x) push_back(x) #define out(x) cout << x #define outl(x) cout << x << endl #define int(x); int x; cin >> x; #define long(x); long long x; cin >> x; #define s(s); string s; cin >>s; #define into(a, n) for (int i = 0; i < n; ++i) cin >> a[i]; using namespace std; const int INF = 1500000000; int main() { int(n); int x[n]; into(x, n); sort(x, x + n); if (x[0] == x[n - 1]) outl(0); else { int res = INF; rep(i, n - 1) res = x[i] == x[i + 1] ? res : min(res, abs(x[i] - x[i + 1])); outl(res); } return 0; }