#include <bits/stdc++.h>
using namespace std;
int main(){
int n;
cin>>n;
int a[n];
for(int i=0;i<n;i++){
cin>>a[i];
}
sort(a,a+n);
int min=1e9;
for(int i=1;i<n;i++){
if(a[i]-a[i-1]<min){
min=a[i]-a[i-1];
}
}
cout<<min<<endl;
return 0;
}
I2luY2x1ZGUgPGJpdHMvc3RkYysrLmg+CnVzaW5nIG5hbWVzcGFjZSBzdGQ7CgppbnQgbWFpbigpewoJaW50IG47CgljaW4+Pm47CglpbnQgYVtuXTsKCWZvcihpbnQgaT0wO2k8bjtpKyspewoJCWNpbj4+YVtpXTsKCX0KCXNvcnQoYSxhK24pOwoJaW50IG1pbj0xZTk7Cglmb3IoaW50IGk9MTtpPG47aSsrKXsKCQlpZihhW2ldLWFbaS0xXTxtaW4pewoJCQltaW49YVtpXS1hW2ktMV07CgkJfQoJfQoJY291dDw8bWluPDxlbmRsOwoJcmV0dXJuIDA7Cn0=