#include using namespace std; #define REP(i, n) for(int i = 0; i < n; i++) #define VSORT(v) sort(v.begin(), v.end()) int main() { ios::sync_with_stdio(false); cin.tie(0); int n; cin >> n; vector x(n); REP(i, n) cin >> x[i]; VSORT(x); int ans = INT_MAX; REP(i, n - 1) { if (x[i + 1] != x[i]) { ans = min(ans, x[i + 1] - x[i]); } } if (ans == INT_MAX) ans = 0; cout << ans << endl; return 0; }