#define _CRT_SECURE_NO_WARNINGS #include using namespace std; typedef long long ll; typedef vector vi; typedef vector vvi; typedef pair pii; #define all(c) (c).begin(), (c).end() #define loop(i,a,b) for(ll i=a; iDUMP &operator,(const T&t){if(this->tellp())*this<<", ";*this< ostream& operator<<(ostream& os, vector const& v){ rep(i,v.size()) os << v[i] << (i+1==v.size()?"":" "); return os; } int x[1000000]; int main(){ int N; while(cin>>N){ rep(i,N) cin >> x[i]; sort(x,x+N); N = unique(x,x+N)-x; int ans = 1<<29; if(N<2) ans = 0; rep(i,N-1){ ans = min(ans, x[i+1]-x[i]); } cout << ans << endl; } }