#include <bits/stdc++.h>
using namespace std;
const int MAX = 1e5 + 5;
constexpr int LOGMAX = 31 - __builtin_clz(MAX) + 5;
int arr[MAX];
int min_st[LOGMAX][MAX], max_st[LOGMAX][MAX];
int n, s1, s2;
int min_query(int l, int r) {
  int sz = r - l + 1;
  int lg = 31 - __builtin_clz(sz);
  return min(min_st[lg][l], min_st[lg][r - (1 << lg) + 1]);
}
int max_query(int l, int r) {
  int sz = r - l + 1;
  int lg = 31 - __builtin_clz(sz);
  return max(max_st[lg][l], max_st[lg][r - (1 << lg) + 1]);
}
bool ok(int limit) {
  if (abs(s1 - s2) > limit) {
    return false;
  }
  int last_ok = n;
  for (int i = int(n - 1); i >= int(1); i--) {
    int pos = arr[i];
    int minn = min_query(i, last_ok);
    int maxx = max_query(i, last_ok);
    if (abs(minn - pos) <= limit && abs(maxx - pos) <= limit) {
      last_ok = i;
    }
  }
  for (auto &pos : {s1, s2}) {
    int minn = min_query(1, last_ok);
    int maxx = max_query(1, last_ok);
    if (abs(minn - pos) <= limit && abs(maxx - pos) <= limit) {
      return true;
    }
  }
  return false;
}
int main() {
  scanf("%d %d %d", &n, &s1, &s2);
  for (int i = int(1); i < int(n + 1); i++) {
    scanf("%d", arr + i);
    min_st[0][i] = max_st[0][i] = arr[i];
  }
  for (int i = int(1); i < int(LOGMAX); i++) {
    for (int j = 1; j + (1 << i) - 1 <= n; j++) {
      min_st[i][j] = min(min_st[i - 1][j], min_st[i - 1][j + (1 << (i - 1))]);
      max_st[i][j] = max(max_st[i - 1][j], max_st[i - 1][j + (1 << (i - 1))]);
    }
  }
  int left = 0, right = (int)1e9;
  int ans = -1;
  while (left <= right) {
    int mid = (left + right) / 2;
    if (ok(mid)) {
      ans = mid;
      right = mid - 1;
    } else {
      left = mid + 1;
    }
  }
  printf("%d\n", ans);
  return 0;
}
