main = do [a,b,c,d] <- map read . words <$> getLine :: IO [Int] print $ length [(x,y)|x <- [a..b], y <- [c..d], x /= y]