import java.io.BufferedReader
import java.io.InputStream
import java.io.InputStreamReader
import java.util.*

fun main(args: Array<String>) {
    val sc = FastScanner(System.`in`)

    val n = sc.nextInt()
    val z = sc.nextInt()
    val w = sc.nextInt()
    val a = Array(n) { sc.nextInt() }

    println(solve(a, z, State(w, 0, 1)))
}


data class State(val other: Int, val cur: Int, val pl: Int)


val solved = mutableMapOf<State, Int>()

fun solve(cards: Array<Int>, card:Int, st: State): Int {
    if (solved.containsKey(st)) return solved[st] ?: throw Exception()

    val cur = st.cur
    val other = st.other
    val pl = st.pl

    if (cur >= cards.size) return Math.abs(card - other)

    if (pl == 1) {
        var best = Math.abs(cards.last() - other)
        for (i in cur until cards.size) {
            best = Math.max(best, solve(cards, other, State(cards[i], i + 1, 2)))
        }
        solved[st] = best
        return best
    }
    if (pl == 2) {
        var best = Math.abs(cards.last() - other)
        for (i in cur until cards.size) {
            best = Math.min(best, solve(cards, other, State(cards[i], i + 1, 1)))
        }
        solved[st] = best
        return best
    }

    throw  Exception()
}

class FastScanner(s: InputStream) {
    private var st = StringTokenizer("")
    private val br = BufferedReader(InputStreamReader(s))

    fun next(): String {
        while (!st.hasMoreTokens()) st = StringTokenizer(br.readLine())

        return st.nextToken()
    }

    fun nextInt() = next().toInt()
    fun nextLong() = next().toLong()
    fun nextLine() = br.readLine()
    fun nextDouble() = next().toDouble()
    fun ready() = br.ready()
}