#include <bits/stdc++.h>
using namespace std;
void re() { vector<int> b(1e10); }
const int N = 1e5 + 3;
const int LOG = 17;
int n;
long long s1, s2;
vector<int> a;
int st_left_min[LOG][N], st_right_min[LOG][N], st_left_max[LOG][N],
    st_right_max[LOG][N], par_left[LOG][N], par_right[LOG][N];
void build_sparse_table() {
  for (int i = 0; i < LOG; ++i) {
    st_left_min[i][0] = st_left_max[i][0] = a[0];
    par_left[i][0] = 0;
    st_right_min[i][n - 1] = st_left_min[i][0] = a[n - 1];
    par_right[i][n - 1] = n - 1;
  }
  for (int i = 1; i < n; ++i) {
    st_left_min[0][i] = st_left_max[0][i] = a[i];
    par_left[0][i] = i - 1;
    for (int j = 1; j < LOG; ++j) {
      par_left[j][i] = par_left[j - 1][par_left[j - 1][i]];
      st_left_min[j][i] =
          min(st_left_min[j - 1][i], st_left_min[j - 1][par_left[j - 1][i]]);
      st_left_max[j][i] =
          max(st_left_max[j - 1][i], st_left_max[j - 1][par_left[j - 1][i]]);
    }
  }
  for (int i = n - 2; i >= 0; --i) {
    st_right_min[0][i] = st_right_max[0][i] = a[i];
    par_right[0][i] = i + 1;
    for (int j = 1; j < LOG; ++j) {
      par_right[j][i] = par_right[j - 1][par_right[j - 1][i]];
      st_right_min[j][i] =
          min(st_right_min[j - 1][i], st_right_min[j - 1][par_right[j - 1][i]]);
      st_right_max[j][i] =
          max(st_right_max[j - 1][i], st_right_max[j - 1][par_right[j - 1][i]]);
    }
  }
}
char did_log[N];
int log_val[N];
int my_log(int n) {
  if (n == 1) return 0;
  if (did_log[n]) return log_val[n];
  did_log[n] = 1;
  int pw = my_log(n - 1);
  log_val[n] = pw;
  if ((1LL << (pw + 1LL)) <= n) ++log_val[n];
  return log_val[n];
}
int get_max(int l, int r) {
  int pw = my_log(r - l + 1);
  return max(st_right_max[pw][l], st_left_max[pw][r]);
}
int get_min(int l, int r) {
  int pw = my_log(r - l + 1);
  return min(st_right_min[pw][l], st_left_min[pw][r]);
}
int t[2][4 * N];
void build(int v, int tl, int tr) {
  if (tl == tr) {
    t[0][v] = t[1][v] = 0;
    return;
  }
  t[0][v] = t[1][v] = -1;
  int tm = tl + tr >> 1;
  build(v << 1, tl, tm);
  build((v << 1) + 1, tm + 1, tr);
}
void push(int v, int turn) {
  if (t[turn][v] != -1) {
    t[turn][v << 1] = t[turn][(v << 1) + 1] = t[turn][v];
    t[turn][v] = -1;
  }
}
void update(int v, int tl, int tr, int l, int r, int turn) {
  if (l > r) return;
  if (tl == l && tr == r) {
    t[turn][v] = 1;
    return;
  }
  push(v, turn);
  int tm = tl + tr >> 1;
  update(v << 1, tl, tm, l, min(r, tm), turn);
  update((v << 1) + 1, tm + 1, tr, max(l, tm + 1), r, turn);
}
int get(int v, int tl, int tr, int pos, int turn) {
  if (tl == tr) return t[turn][v];
  push(v, turn);
  int tm = tl + tr >> 1;
  if (pos <= tm)
    return get(v << 1, tl, tm, pos, turn);
  else
    return get((v << 1) + 1, tm + 1, tr, pos, turn);
}
int bin_search(int l, int r, int zero, int val) {
  int start = l;
  while (l < r) {
    int m = l + r >> 1;
    if (get_max(start, m) - zero <= val && zero - get_min(start, m) <= val)
      l = m + 1;
    else
      r = m;
  }
  return l - 1;
}
bool solve(int max_dist) {
  if (abs(s1 - s2) > max_dist) return false;
  build(1, 0, n - 1);
  update(1, 0, n - 1, 0, bin_search(0, n, s1, max_dist), 1);
  update(1, 0, n - 1, 0, bin_search(0, n, s2, max_dist), 0);
  for (int i = 0; i < n; ++i) {
    for (int turn : {0, 1}) {
      if (!get(1, 0, n - 1, i, turn)) continue;
      update(1, 0, n - 1, i + 1, bin_search(i + 1, n, a[i], max_dist), !turn);
    }
  }
  return get(1, 0, n - 1, n - 1, 0) || get(1, 0, n - 1, n - 1, 1);
}
bool brute(int max_dist) {
  vector<vector<char> > dp(2, vector<char>(n, 0));
  if (abs(s1 - s2) > max_dist) return false;
  for (int i = 0; i < n; ++i)
    if (abs(s1 - a[i]) <= max_dist)
      dp[1][i] = 1;
    else
      break;
  for (int i = 0; i < n; ++i)
    if (abs(s2 - a[i]) <= max_dist)
      dp[0][i] = 1;
    else
      break;
  for (int i = 0; i < n; ++i) {
    for (int turn : {0, 1}) {
      if (!dp[turn][i]) continue;
      for (int j = i + 1; j < n; ++j)
        if (abs(a[j] - a[i]) <= max_dist)
          dp[!turn][j] = 1;
        else
          break;
    }
  }
  return dp[1][n - 1] || dp[0][n - 1];
}
void clear_segment_tree() {
  for (int i : {0, 1})
    for (int j = 0; j < 4 * N; ++j) t[i][j] = -1;
}
void make_test() {
  n = rand() % 5 + 1;
  s1 = rand() % 1000000000;
  s2 = rand() % 1000000000;
  a.clear();
  a.resize(n);
  for (int i = 0; i < n; ++i) a[i] = rand() % 1000000000;
}
void stress() {
  int cnt = 1;
  while (true) {
    clear_segment_tree();
    make_test();
    build_sparse_table();
    while (true) {
      int max_dist = rand() % 1000000000;
      if (solve(max_dist) != brute(max_dist)) {
        cout << "cnt = " << cnt << endl;
        cout << "max_dist = " << max_dist << endl;
        cout << n << " " << s1 << " " << s2 << endl;
        for (int i = 0; i < n; ++i) cout << a[i] << " ";
        cout << endl;
        cout << "solve = " << solve(max_dist) << endl;
        cout << "brute = " << brute(max_dist) << endl;
        return;
      }
    }
    ++cnt;
  }
}
void read() {
  cin >> n >> s1 >> s2;
  a.clear();
  a.resize(n);
  for (int i = 0; i < n; ++i) cin >> a[i];
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(NULL);
  cout.tie(NULL);
  srand(time(0));
  cin >> n >> s1 >> s2;
  a.resize(n);
  for (int i = 0; i < n; ++i) cin >> a[i];
  build_sparse_table();
  int l = 0, r = 1e9 + 1;
  while (l < r) {
    int m = l + r >> 1;
    if (solve(m))
      r = m;
    else
      l = m + 1;
    if (l == r - 1)
      if (solve(l))
        r = l;
      else
        l = r;
  }
  cout << r;
}
