action_x = nil
do
    local memo = {}
    action_x = function(tbl, left_i, w_idx)
        if not memo[left_i] then
            memo[left_i] = {}
        elseif memo[left_i][w_idx] then
            return memo[left_i][w_idx]
        end
        
        local max_abs = math.abs(tbl[#tbl] - tbl[w_idx])
        
        for i = left_i, #tbl - 1 do
            local diff = action_y(tbl, i + 1, i)
            if diff > max_abs then
                max_abs = diff
            end
        end
        memo[left_i][w_idx] = max_abs
        return max_abs
    end
end

action_y = nil
do
    local memo = {}
    action_y = function(tbl, left_i, z_idx)
        if not memo[left_i] then
            memo[left_i] = {}
        elseif memo[left_i][w] then
            return memo[left_i][z_idx]
        end
        
        local min_abs = math.abs(tbl[#tbl] - tbl[z_idx])
        
        for i = left_i, #tbl - 1 do
            local diff = action_x(tbl, i + 1, i)
            if diff < min_abs then
                min_abs = diff
            end
        end
        memo[left_i][z_idx] = min_abs
        return min_abs
    end
end

function main()
    local nzw_input = string.gmatch(io.read(), "%d+")
    local n = tonumber(nzw_input())
    local z = tonumber(nzw_input())
    local w = tonumber(nzw_input())
    local a = {}
    for i in string.gmatch(io.read(), "%d+") do
        table.insert(a, tonumber(i))
    end
    
    if #a == 1 then
        return math.abs(a[1] - w)
    end
    
    table.insert(a, 1, w)
    
    return action_x(a, 2, 1)
end

print(main())