#include #include #include using namespace std; int main(){ int n; cin >> n; vector v,w; int dis; dis = 1000000; for (int i = 0; i < n; i++) { int a; cin >> a; v.push_back(a); } sort(v.begin(),v.end()); for (int i = 0; i < n - 1; i++) { int t = v[i + 1] - v[i]; //cout << t << "\n"; if (t != 0 && dis > t) { dis = t; } } if(n == 1){ cout << 0 <<"\n"; }else{ cout << dis << "\n"; } return 0; }