#include <bits/stdc++.h>
const int maxn = 1e6 + 50;
using namespace std;
int n, s, t;
int a[maxn];
bool check(int x) {
  if (abs(s - t) > x) return false;
  int l = a[n] - x, r = a[n] + x;
  for (int i = n - 1; i; i--) {
    if (l > r) return false;
    if (l <= a[i] && a[i] <= r) {
      l = a[i] - x;
      r = a[i] + x;
    } else {
      l = max(a[i] - x, l);
      r = min(a[i] + x, r);
    }
  }
  return ((s >= l && s <= r) || (t >= l && t <= r));
}
int main() {
  scanf("%d%d%d", &n, &s, &t);
  for (int i = 1; i <= n; i++) scanf("%d", &a[i]);
  int l = 0, r = 1e9;
  int ans = 1e9;
  while (l < r) {
    int mid = (l + r) >> 1;
    if (check(mid)) {
      ans = mid;
      r = mid - 1;
    } else
      l = mid + 1;
  }
  if (check(l)) ans = l;
  ans = max(ans, abs(s - t));
  printf("%d\n", ans);
  return 0;
}
