#include #include #include #include #include #include #include #include #include #include #include #include #include using namespace std; const int N6 = 1e6 + 6; const int N9 = 1e9 + 7; typedef unsigned long long ull; typedef long long ll; typedef double ld; typedef pair PII; typedef pair PIl; typedef pair PlI; typedef pair Pll; #define F first #define S second #define pb push_back #define p push #define mp make_pair #define re(x, a) for (__typeof(a) x = 1; x <= a; ++x) #define reo(x, a) for (__typeof(a) x = 1; x <= a; ++x) #define rep(x, a) for (__typeof(a) x = 1; x <= a; ++x) #define erp(x, a) for (__typeof(a) x = 1; x <= a; ++x) #define repp(x, a) for (__typeof(a) x = 0; x < a; ++x) #define epo(x, a) for (__typeof(a) x = 1; x <= a; ++x) #define itn int #define for1(x, a, b) for (int x = b; x >= a; --x) #define sz(x) (int)x.size() #define siz size #define skip continue #define gg exit(0) #define boost ios_base::sync_with_stdio(0),cin.tie(NULL) #define task "a" const ll N = 1e5 + 200; const int INF = (int)1e9 + 100; const ll mod = 1e9 + 7; const ll BLOCK = 316; int n,a[N]; ll ans = 999999999999; int main(){ // #ifndef ONLINE_JUDGE // #endif boost; cin >> n; for(int i = 1; i <= n; ++i){ cin >> a[i]; } sort(a+1,a+n+1); for(int i = 1; i < n; ++i){ if( abs(a[i+1]-a[i]) < ans )ans = abs(a[i+1]-a[i]); } cout << ans; return 0; }