#include #include #include #include using namespace std; int main() { int n; cin >> n; vector v(n); for (int i = 0; i < n; ++i) { cin >> v.at(i); } sort(v.begin(), v.end()); int p = 0; for (int j = 0; j < n - 1; ++j) { if (v.at(j) != v.at(j + 1)) { if (p == 0) { p = abs(v.at(j) - v.at(j + 1)); } else if (p > abs(v.at(j) - v.at(j + 1))) { p = abs(v.at(j) - v.at(j + 1)); } } } cout << p << endl; return 0; }