#include <iostream>
#include <algorithm>
using namespace std;
const int N = 1010;
int a[N];
int n;
int main(){
cin >> n;
for(int i = 0;i < n;i++) cin >> a[i];
sort(a,a + n);
int ans = a[0],res = 0x3f3f3f3f;
for(int i = 1;i < n;i++){
res = min(res,abs(ans - a[i]));
ans = a[i];
}
cout << res << endl;
return 0;
}