import Control.Monad (replicateM)

main :: IO ()
main = do
  n <- readLn
  xs <- replicateM n $ getInts
  print $ solve xs

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

solve :: [[Int]] -> Int
solve = foldl (\acc [l,r] -> acc + r - l + 1) 0
