import Control.Monad

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

main :: IO ()
main = do
  n <- readLn
  lrs <- replicateM n $ map read . words <$> getLine :: IO [[Int]]
  print $ solve lrs