import Control.Monad

main :: IO ()
main = do
  n <- readLn :: IO Int
  ns <- replicateM n $ do
    [a, b] <- getInts
    return $ b - a +1
  print $ sum ns

getInts :: IO [Int]
getInts = map read . words <$> getLine
