import Data.List

main = do
  (n:z:w:ws) <- map (read :: String -> Int) . words <$> getLine
  a <- map (read :: String -> Int) . words <$> getLine
  if length a < 2 then print $ abs $ (head a) - w
                  else let min = minimum . init $ a
                           max = maximum . init $ a
                           lastA = last a
                           ans = maximum . map abs $ [lastA - w, xMoveToMin w a, xMoveToMax w a]
                       in print ans

xMoveToMin :: Int -> [Int] -> Int
xMoveToMin y s = let min = minimum s
                     minIndex = head $ elemIndices min s
                     remain = drop (minIndex + 1) s
                 in if length remain == 0 then y - min
                                          else yMoveToMin min remain

xMoveToMax :: Int -> [Int] -> Int
xMoveToMax y s = let max = maximum s
                     maxIndex = head $ elemIndices max s
                     remain = drop (maxIndex + 1) s
                 in if length remain == 0 then max - y
                                          else yMoveToMax max remain

yMoveToMin :: Int -> [Int] -> Int
yMoveToMin x s = let min = minimum s
                     minIndex = head $ elemIndices min s
                     remain = drop (minIndex + 1) s
                 in if length remain == 0 then x - min
                                          else xMoveToMax min remain

yMoveToMax :: Int -> [Int] -> Int
yMoveToMax x s = let max = maximum s
                     maxIndex = head $ elemIndices max s
                     remain = drop (maxIndex + 1) s
                 in if length remain == 0 then max - x
                                          else xMoveToMin max remain

