#include<bits/stdc++.h> using namespace std; #define ll long long int ll a[100005]; int main() { ios::sync_with_stdio(0); cin.tie(0); ll i,j,k,n; cin>>n; for(i=1;i<=n;i++) { cin>>a[i]; } sort(a+1,a+n+1); ll ans=1e10; for(i=1;i<n;i++) { ans=min(ans,a[i+1]-a[i]); } cout<<ans; return 0; }