#include <bits/stdc++.h> #define LL long long #define L long #define I int #define FOR(i,s,n) for(int i=s;i<n;i++) #define FORR(i,n,s) for(int i=n-1;i>=s;i--) #define max_size_segTree(n) 2*(int)pow(2, (int)(ceil(log2(n)))) - 1 #define m(a,b) memset(a,b,sizeof(a)) #define mp make_pair #define pb push_back #define MAX 1000000007 #define INF 1e18+1 using namespace std; int main() { I n; cin>>n; LL ar[n]; FOR(i,0,n){ cin>>ar[i]; } sort(ar,ar+n); LL ans = 10000000000; FOR(i,1,n){ ans = min(ans,abs(ar[i-1]-ar[i])); } cout<<ans<<endl; return 0; }