#include using namespace std; #define REP(i,n) for(int i=0; i<(int)(n); i++) int main() { ios_base::sync_with_stdio(0); cin.tie(0); int n; cin >> n; vector x(n); REP (i, n) cin >> x[i]; sort(x.begin(), x.end()); x.erase(unique(x.begin(), x.end()), x.end()); if (x.size() == 1) cout << 0 << endl; else { int ret = x[1] - x[0]; REP (i, n-1) ret = min(ret, x[i+1] - x[i]); cout << ret << endl; } return 0; }