#define _CRT_SECURE_NO_WARNINGS #include #include #include #include #include #include #include #include #include #include #include #define rep(i,j,k) for(int i=(int)j;i<(int)k;i++) #define repp(i,j,k) for(int i=j;i>=k;i--) #define llrep(i,j,k) for(long long int i=j;i<(long long int)k;i++) #define Sort(x) sort(x.begin(),x.end()); #define vi vector #define vvi vector> #define ll long long int mod=1e9+7; const int INF = 100000000; using namespace std; void p(int x) { cout << x << endl; } void pp(string s) { cout << s << endl; } int main(void) { int n; cin >> n; int minn = INF; vector v(n); rep(i, 0, n)scanf("%d", &v[i]); Sort(v); rep(i, 0, n-1) { if(v[i+1]-v[i]!=0)minn = min(minn, abs(v[i+1] - v[i])); } cout << minn << endl; return 0; }