#include <bits/stdc++.h>
using namespace std;
int n, p, q, a[100010][2], f[100010][2], mn[100010][18], mx[100010][18],
    LG2[100010], tree[100010][2];
int query_max(int l, int r) {
  if (l > r) return 0;
  return max(mx[l][LG2[r - l + 1]],
             mx[r - (1 << LG2[r - l + 1]) + 1][LG2[r - l + 1]]);
}
int query_min(int l, int r) {
  if (l > r) return 1000000000;
  return min(mn[l][LG2[r - l + 1]],
             mn[r - (1 << LG2[r - l + 1]) + 1][LG2[r - l + 1]]);
}
void add(int i, int k, int x) {
  while (k <= n + 1) tree[k][i] += x, k += k & -k;
}
int query(int i, int k) {
  int s = 0;
  while (k) s += tree[k][i], k -= k & -k;
  return s;
}
bool check(int k) {
  memset(f, 0, sizeof(f));
  memset(tree, 0, sizeof(tree));
  f[0][0] = f[0][1] = 1;
  for (int i = 0; i <= n; i++)
    for (int j = 0; j < 2; j++) {
      if (i) f[i][j] = (query(j, i) > 0);
      if (f[i][j]) {
        int l = i + 1, r = n, x = i;
        while (l <= r) {
          int mid = l + r >> 1;
          if (query_max(i + 1, mid) - a[i][j] <= k &&
              a[i][j] - query_min(i + 1, mid) <= k)
            x = mid, l = mid + 1;
          else
            r = mid - 1;
        }
        add(j ^ 1, i + 1, 1), add(j ^ 1, x + 1, -1);
      }
    }
  return f[n][0] | f[n][1];
}
int main() {
  cin >> n >> a[0][0] >> a[0][1];
  for (int i = 1; i <= n; i++) {
    cin >> mn[i][0];
    mx[i][0] = a[i][0] = a[i][1] = mn[i][0];
  }
  for (int j = 1; j < 18; j++)
    for (int i = 1; i <= n; i++)
      mx[i][j] = max(mx[i][j - 1], mx[min(n, i + (1 << j - 1))][j - 1]),
      mn[i][j] = min(mn[i][j - 1], mn[min(n, i + (1 << j - 1))][j - 1]);
  for (int i = 2; i <= n; i++) {
    LG2[i] = LG2[i - 1];
    if ((2 << LG2[i]) <= i) LG2[i]++;
  }
  int l = abs(a[0][0] - a[0][1]), r = 1000000000, ans;
  while (l <= r) {
    int mid = l + r >> 1;
    if (check(mid))
      ans = mid, r = mid - 1;
    else
      l = mid + 1;
  }
  cout << ans << endl;
  return 0;
}
