module Main where

iota :: [Int] -> [Int]
iota [x, y] = [x..y]

main :: IO ()
main = do
  n <- getLine >>= \x -> return (read x::Int)
  l_r <- sequence (take n (repeat (getLine >>=
                                   \line -> return $ iota (map read (words line)))))
  print $ length $ concat l_r
