import std.algorithm, std.conv, std.range, std.stdio, std.string;
import std.math;      // math functions

void main()
{
  auto rd = readln.split.to!(int[]), n = rd[0], z = rd[1], w = rd[2];
  auto a = readln.split.to!(int[]);

  writeln(calc1(z, w, a));
}

int calc1(int x, int y, int[] a)
{
  if (a.length == 1) return (y-a[0]).abs;
  auto r = (y-a[$-1]).abs, mi = a[$-1], ma = a[$-1];
  foreach_reverse (i, ai; a[0..$-1]) {
    if ((ai - mi).abs > r || (ai - ma).abs > r) r = max(r, calc2(ai, y, a[i+1..$]));
    mi = min(mi, ai);
    ma = max(mi, ai);
  }
  return r;
}

int calc2(int x, int y, int[] a)
{
  if (a.length == 1) return (x-a[0]).abs;
  auto r = (x-a[$-1]).abs, mi = a[$-1], ma = a[$-1];
  foreach_reverse (i, ai; a[0..$-1]) {
    if ((ai - mi).abs < r || (ai - ma).abs < r) r = min(r, calc1(x, ai, a[i+1..$]));
    mi = min(mi, ai);
    ma = max(mi, ai);
  }
  return r;
}
