#pragma GCC target("avx2") #pragma GCC optimize("O3") #pragma GCC optimize("unroll-loops") #include // #include using namespace std; // using namespace atcoder; #define rep(i,m,n,k) for (int i = (int)(m); i < (int)(n); i += (int)(k)) #define rrep(i,m,n,k) for (int i = (int)(m); i > (int)(n); i += (int)(k)) #define ll long long #define list(T,A,N) vector A(N);for(int i=0;i<(int)(N);i++){cin >> A[i];} #define all(X) X.begin(),X.end() template inline bool chmin(T& a, T b){if(a > b){a = b; return true;} return false;} template inline bool chmax(T& a, T b){if(a < b){a = b; return true;} return false;} template map Counter(vector X){map C;for(auto x:X){C[x]++;}; return C;} constexpr ll INF = (1LL<<60); int main(){ ios::sync_with_stdio(false); std::cin.tie(nullptr); int N; cin >> N; list(ll,X,N); sort(all(X)); X.erase(unique(all(X)),X.end()); N = (int)X.size(); if (N==1){ cout << 0 << endl; return 0; } ll ans = INF; rep(i,0,N-1,1){ ans = min(ans,X[i+1]-X[i]); } cout << ans << endl; return 0; }