{-# OPTIONS_GHC -O2 -funbox-strict-fields #-}
import qualified Data.ByteString.Char8 as BS
import           Data.Maybe            (fromJust)

main :: IO ()
main = do
  [a, b, c, d] <- map readInt . BS.words <$> BS.getLine
  print $ solve a b c d

solve :: Int -> Int -> Int -> Int -> Int
solve a b c d = length $ filter p [0 .. 100] where
  p i = a <= i && i < b && c <= i && i < d

readInt :: BS.ByteString -> Int
readInt = fst . fromJust . BS.readInt
