/* No.135 とりあえず1次元の問題 https://yukicoder.me/problems/no/135 */ #include using namespace std; #define MAX 10000001 int main() { ios::sync_with_stdio(0); cin.tie(0); int n; cin >> n; vector vi(n); for (int i = 0; i < n; i++) { cin >> vi[i]; } sort(vi.begin(), vi.end()); if (n == 1) { cout << 0 << endl; return 0; } int minimum = vi[0] - vi[1]; int _min = MAX; for (int i = 0; i < n - 1; i++) { int cur = abs(vi[i] - vi[i + 1]); if (_min > cur && cur != 0) _min = cur; } if (minimum == _min || _min == MAX) { cout << 0 << endl; return 0; } cout << _min << endl; }