import Data.List (sort)
import Control.Applicative ((<$>))

main :: IO ()
main = do
  n <- map (read :: String -> Int) . words <$> getLine
  print $ solve $ sort n

solve :: [Int] -> Int
solve (a:b:c:d:_) = abs ((a + d) - (b + c))
