#include <bits/stdc++.h>
using namespace std;
const int N = 100005;
int n, s1, s2;
int x[N];
int mnX[N][17], mxX[N][17];
int lg2[N];
void prep() {
  for (int i = 1; i <= n; ++i) mnX[i][0] = mxX[i][0] = x[i];
  for (int j = 1; j < 17; ++j)
    for (int i = 1; i + (1 << j) - 1 <= n; ++i) {
      mnX[i][j] = min(mnX[i][j - 1], mnX[i + (1 << (j - 1))][j - 1]);
      mxX[i][j] = max(mxX[i][j - 1], mxX[i + (1 << (j - 1))][j - 1]);
    }
  for (int i = 1; i <= n; ++i) lg2[i] = (int)log2(i);
}
int get_min(int l, int r) {
  int k = lg2[r - l + 1];
  return min(mnX[l][k], mnX[r - (1 << k) + 1][k]);
}
int get_max(int l, int r) {
  int k = lg2[r - l + 1];
  return max(mxX[l][k], mxX[r - (1 << k) + 1][k]);
}
int T[N];
bool solve(int p) {
  for (int i = 1; i <= n; ++i) T[i] = 0;
  int mn = 1e9, mx = 0;
  for (int i = 1; i <= n; ++i) {
    mn = min(mn, x[i]);
    mx = max(mx, x[i]);
    if (max(abs(s1 - mn), abs(s1 - mx)) <= p) ++T[i], --T[i + 1];
  }
  int sum = 0;
  for (int i = 1; i < n; ++i) {
    sum += T[i];
    if (sum == 0) return false;
    int l = i + 1, r = n;
    while (l < r) {
      int mid = ((l + r + 1) >> 1);
      if (get_min(i + 1, mid) >= x[i] - p && get_max(i + 1, mid) <= x[i] + p)
        l = mid;
      else
        r = mid - 1;
    }
    if (get_min(i + 1, l) >= x[i] - p && get_max(i + 1, l) <= x[i] + p) {
      ++T[i + 1];
      --T[l + 1];
    }
  }
  sum += T[n];
  return sum > 0;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cin >> n >> s1 >> s2;
  for (int i = 1; i <= n; ++i) cin >> x[i];
  prep();
  int l = abs(s1 - s2), r = 1e9;
  while (l < r) {
    int p = ((l + r) >> 1);
    bool check = solve(p);
    swap(s1, s2);
    check |= solve(p);
    if (check)
      r = p;
    else
      l = p + 1;
  }
  cout << l << endl;
}
