#include using namespace std; const int64_t INF = 100000000; int main() { int64_t N; cin >> N; vector X(N); for(int i = 0; i < N; i++) cin >> X[i]; sort(X.begin(), X.end()); int64_t ans = INF; for(int i = 0; i < N - 1; i++) { if(X[i + 1] == X[i]) continue; ans = min(ans, X[i + 1] - X[i]); } cout << ans << endl; return 0; }