import std.stdio, std.array, std.string, std.conv, std.algorithm;
import std.typecons, std.range, std.random, std.math, std.container;
import std.numeric, std.bigint, core.bitop;

immutable long INF = 1L << 60;

void main() {
    auto s = readln.split.map!(to!int);
    auto N = s[0];
    auto X = s[1].to!long;
    auto Y = s[2].to!long;
    auto A = readln.split.map!(to!long).array;

    auto mem = new long[][][](N+1, N+1, 2);
    foreach (i; 0..N+1) foreach (j; 0..N+1) mem[i][j].fill(-1);

    long dfs(int x, int y, int turn) {
        long xp = x == 0 ? X : A[x-1];
        long yp = y == 0 ? Y : A[y-1];

        if (x == N || y == N)
            return abs(xp - yp);
        if (mem[x][y][turn] >= 0)
            return mem[x][y][turn];


        long ret;

        if (turn == 0) { // 先手
            ret = 0;
            foreach (i; max(x+1, y+1)..N+1) {
                ret = max(ret, dfs(i, y, 1));
            }
        } else {
            ret = INF;
            foreach (i; max(x+1, y+1)..N+1) {
                ret = min(ret, dfs(x, i, 0));
            }
        }

        mem[x][y][turn] = ret;
        return ret;
    }

    dfs(0, 0, 0).writeln;
}
