#include #include #include #include #include #include #include #include #include #include using namespace std; int main(){ int n, min1 = 1000000, p = 0; cin >> n; vector v(n); for (int i = 0; i < n; i++) cin >> v[i]; sort(v.begin(), v.end()); for (int i = 0; i < n - 1; i++){ if(v[i] != v[i+1]){ min1 = min(min1, abs(v[i+1] -v[i])); } } cout << ((min1 == 1000000) ? 0 : min1) << endl; }