#include <bits/stdc++.h>
using namespace std;
int n, a[100005], b1[100005], b2[100005];
void add(int x, int v) {
  while (x <= n) {
    b1[x] = min(b1[x], v);
    b2[x] = max(b2[x], v);
    x += (x & (-x));
  }
}
bool ok(int x, int v, int k) {
  int A = 2147483647, B = 0;
  while (x) {
    A = min(A, b1[x]);
    B = max(B, b2[x]);
    x -= (x & (-x));
  }
  return abs(A - v) <= k && abs(B - v) <= k;
}
int main() {
  int A, B;
  scanf("%d%d%d", &n, &A, &B);
  for (int i = 1; i <= n; i++) scanf("%d", &a[i]);
  int l = abs(A - B), r = 1e9;
  while (l != r) {
    int m = (l + r) / 2, last = n;
    for (int i = 1; i < n; i++) b1[i] = 2147483647;
    for (int i = 1; i < n; i++) b2[i] = 0;
    b1[n] = b2[n] = a[n];
    for (int i = n - 1; i >= 1; i--) {
      if (ok(last, a[i], m)) last = i;
      add(i, a[i]);
    }
    if (ok(last, A, m) || ok(last, B, m))
      r = m;
    else
      l = m + 1;
  }
  printf("%d\n", l);
  return 0;
}
