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 = last $ elemIndices min s
                     remain = drop (minIndex + 1) s
                     minY = minimum remain
                     lastA = last remain
                 in if minY == lastA then maximum . map abs $ [minY - lastA, lastA - y]
                                     else maximum . map abs $ [minY - min, minY - y]

xMoveToMax :: Int -> [Int] -> Int
xMoveToMax y s = let max = maximum s
                     maxIndex = last $ elemIndices max s
                     remain = drop (maxIndex + 1) s
                     maxY = maximum remain
                     lastA = last remain
                 in if maxY == lastA then maximum . map abs $ [maxY - lastA, lastA - y]
                                     else maximum . map abs $ [maxY - max, maxY - y]
