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 [(abs $ lastA - w), max - lastA, lastA - min]
                       in print ans
