#include #include #include using namespace std; int main() { cin.tie(0); ios::sync_with_stdio(false); int n, d; cin >> n; vector a(n); for (auto& e : a) cin >> e; sort(a.begin(), a.end()); int min = 1000001; for (int i = 0; i < n - 1; i++) { if (a[i] == a[i + 1]) { continue; } d = a[i + 1] - a[i]; if (d < min) min = d; } if (min == 1000001) min = 0; cout << min << endl; }