#include using namespace std; int X[100000]; int main() { int N; cin>>N; if (N == 1) { cout << 0 << endl; return 0; } for(int i = 0; i < N; ++i) cin >> X[i]; int mi =1e9; for (int i = 0; i < N; ++i) { for (int j = 0; j < i; ++j) { if (X[i]==X[j]) continue; mi = min(mi, abs(X[i]-X[j])); } } cout << mi << endl; }