#include using namespace std; int main() { int64_t N; cin >> N; vector xs(N); for (int64_t i = 0; i < N; i++) { cin >> xs[i]; } int64_t ans = 1LL << 48; sort(xs.begin(), xs.end()); for (int64_t i = 0; i < N - 1; i++) { if (xs[i] != xs[i + 1]) { ans = min(ans, xs[i + 1] - xs[i]); } } if (ans == 1LL << 48) ans = 0; cout << ans << endl; return 0; }