#include <bits/stdc++.h>   using namespace std;   const int N = 110000;   int s1, s2;   int n, a[N];   int mi[17][N * 2], ma[17][N * 2];   int BB[N * 2];   int getmi(int l, int r) {     return min(mi[BB[r - l + 1]][l],                mi[BB[r - l + 1]][r - (1 << BB[r - l + 1]) + 1]);   }   int getma(int l, int r) {     return max(ma[BB[r - l + 1]][l],                ma[BB[r - l + 1]][r - (1 << BB[r - l + 1]) + 1]);   }   void init() {     for (int j = (int)0; j <= (int)16; j++)       for (int i = (int)(1 << j); i <= (int)(1 << (j + 1)) - 1; i++) BB[i] = j;     for (int i = (int)1; i <= (int)n; i++) {       mi[0][i] = ma[0][i] = a[i];     }     for (int j = (int)1; j <= (int)16; j++)       for (int i = (int)1; i <= (int)n - (1 << j) + 1; i++) {         mi[j][i] = min(mi[j - 1][i], mi[j - 1][i + (1 << (j - 1))]);         ma[j][i] = max(ma[j - 1][i], ma[j - 1][i + (1 << (j - 1))]);       }   }   bool f[N], g[N];   bool check(int S) {     for (int i = (int)0; i <= (int)n; i++) f[i] = g[i] = 0;     f[0] = g[0] = 1;     int maf, mag;     maf = mag = 0;     for (int i = (int)0; i <= (int)n - 1; i++) {       bool f1 = (i <= maf);       bool f2 = (i <= mag);       if (f1) {         int now = a[i];         if (i == 0) now = s1;         int l = i + 1;         int r = n;         int rt = 0;         while (l < r) {           int mid = (l + r) >> 1;           if ((abs(getma(i + 1, mid) - now) > S) ||               (abs(getmi(i + 1, mid) - now) > S))             r = mid;           else             l = mid + 1, rt = mid;         }         if (!(abs((getma(i + 1, l) - now) > S) ||               (abs(getmi(i + 1, l) - now) > S)))           rt = l;         mag = max(mag, rt);       }       if (f2) {         int now = a[i];         if (i == 0) now = s2;         int l = i + 1;         int r = n;         int rt = 0;         while (l < r) {           int mid = (l + r) >> 1;           if ((abs(getma(i + 1, mid) - now) > S) ||               (abs(getmi(i + 1, mid) - now) > S))             r = mid;           else             l = mid + 1, rt = mid;         }         if (!((abs(getma(i + 1, l) - now) > S) ||               (abs(getmi(i + 1, l) - now) > S)))           rt = l;         maf = max(maf, rt);       }     }     return (maf == n) || (mag == n);   }   int main() {     scanf( %d%d%d , &n, &s1, &s2);     for (int i = (int)1; i <= (int)n; i++) scanf( %d , &a[i]);     init();     int L = abs(s1 - s2);     int R = 1000000000;     int ans = 0;     while (L < R) {       int mid = (L + R) >> 1;       if (check(mid))         ans = mid, R = mid;       else         L = mid + 1;     }     if (check(L)) ans = L;     cout << ans << endl;     return 0;   }   