#include <bits/stdc++.h>   using namespace std;   const int N = 100005;   int sz = 1;   int t[N << 2], clr[N << 2];   inline void pushclear(int k) {     if (!clr[k]) return;     t[k] = 0;     if (k < sz) clr[k << 1] = clr[k << 1 | 1] = 1;     clr[k] = 0;   }   inline void clear(int k, int l, int r, int a, int b) {     pushclear(k);     if (a > r || b < l) return;     if (a >= l && b <= r) {       clr[k] = 1;       pushclear(k);       return;     }     int mid = (a + b) >> 1;     clear(k << 1, l, r, a, mid), clear(k << 1 | 1, l, r, mid + 1, b);     t[k] = t[k << 1] + t[k << 1 | 1];   }   inline void add(int k, int pos, int a, int b, int x) {     pushclear(k);     if (a == b) {       t[k] += x;       return;     }     int mid = (a + b) >> 1;     if (pos <= mid)       add(k << 1, pos, a, mid, x);     else       add(k << 1 | 1, pos, mid + 1, b, x);     t[k] = t[k << 1] + t[k << 1 | 1];   }   int n, init_x, init_y;   int a[N];   vector<int> vec;   inline int getpos(int x) {     return lower_bound(vec.begin(), vec.end(), x) - vec.begin() + 1;   }   bool check(int mid) {     for (int i = 1; i < (sz << 1); i++) t[i] = clr[i] = 0;     add(1, getpos(init_x), 1, sz, 1);     add(1, getpos(init_y), 1, sz, 1);     for (int i = 1; i <= n; i++) {       int l = lower_bound(vec.begin(), vec.end(), a[i] - mid) - vec.begin() + 1;       int r = lower_bound(vec.begin(), vec.end(), a[i] + mid) - vec.begin() + 1;       if (r > vec.size() || vec[r - 1] > a[i] + mid) r--;       if (l - 1 >= 1) clear(1, 1, l - 1, 1, sz);       if (r + 1 <= sz) clear(1, r + 1, sz, 1, sz);       if (t[1] == 0) return false;       add(1, getpos(a[i]), 1, sz, 1);     }     return true;   }   int main() {     scanf( %d%d%d , &n, &init_x, &init_y);     for (int i = 1; i <= n; i++) {       scanf( %d , &a[i]);       vec.emplace_back(a[i]);     }     vec.emplace_back(init_x);     vec.emplace_back(init_y);     sort(vec.begin(), vec.end());     vec.resize(unique(vec.begin(), vec.end()) - vec.begin());     while (sz < vec.size()) sz <<= 1;     int l = abs(init_x - init_y), r = 1000000000, mid, ans;     while (l <= r) {       mid = (l + r) >> 1;       if (check(mid))         r = mid - 1, ans = mid;       else         l = mid + 1;     }     printf( %d n , ans);     return 0;   }   