/********************************************************************* 程序名: 版权: Joecai 作者: Joecai 日期: 2022-04-04 19:00 说明: *********************************************************************/ #include <bits/stdc++.h> using namespace std; #define y second # define rep(i,be,en) for(int i=be;i<=en;i++) # define pre(i,be,en) for(int i=be;i>=en;i--) typedef pair<int, int> PII; #define ll long long #define endl "\n" #define LOCAL #define pb push_back #define eb emplace_back #define sp(i) setprecision(i) const int N = 2e5 + 10, INF = 0x3f3f3f3f; ll qpow(int a, int b) { ll ans = 1; while (b) { if (b & 1) ans = ans * a; a = (ll)a * a; b >>= 1; } return ans; } inline int read() { int X = 0; bool flag = 1; char ch = getchar(); while (ch < '0' || ch > '9') { if (ch == '-') flag = 0; ch = getchar(); } while (ch >= '0' && ch <= '9') { X = (X << 1) + (X << 3) + ch - '0'; ch = getchar(); } if (flag) return X; return ~(X - 1); } inline void write(int X) { if (X < 0) { X = ~(X - 1); putchar('-'); } if (X > 9) write(X / 10); putchar(X % 10 + '0'); } struct dsu { private: vector<int> par, ran, cnt; public: dsu(int n) { par.resize(n, 0); iota(par.begin(), par.end(), 0); ran.resize(n, 0); cnt.resize(n, 1); } int find(int x) { if (par[x] == x)return x; else return par[x] = find(par[x]); } bool unite(int x, int y) { x = find(x), y = find(y); if (x == y) return false; if (ran[x] < ran[y]) { par[x] = y; cnt[y] += cnt[x]; } else { par[y] = x; cnt[x] += cnt[y]; if (ran[x] == ran[y])ran[x]++; } return true; } bool same(int x, int y) { return find(x) == find(y); } int getcnt(int x) { return cnt[find(x)]; } }; struct node { double mi; double mx; int cnt; }; node x[N]; double a[N]; int n; void solve() { cin >> n; double mx = -INF; double mi = INF; for (int i = 1; i <= n; i++) { cin >> a[i]; mx = max(mx, a[i]); mi = min(mi, a[i]); } if (n == 2) { cout << mx - mi << endl; return; } for (int i = 0; i <= n; i++) { x[i].mi = INF, x[i].mx = -INF; } double gap = (mx - mi) / (n - 1.0); for (int i = 1; i <= n; i++) { int t = (int)(a[i] - mi) / gap; x[t].cnt++; x[t].mi = min(x[t].mi, a[i]); x[t].mx = max(x[t].mx, a[i]); } double ans = -INF; for (int i = 2; i <= n; i++) { if (!x[i].cnt) { x[i].mx = x[i - 1].mx; x[i].mi = x[i - 1].mx; } if (x[i].mi - x[i - 1].mx > ans) { ans = x[i].mi - x[i - 1].mx; } } cout << ans << endl; } int main() { std::ios::sync_with_stdio(false); std::cin.tie(nullptr); //#ifdef LOCAL //freopen("data.in.txt","r",stdin); //freopen("data.out.txt","w",stdout); //#endif int __ = 1; while (__--) { solve(); } return 0; }