import Control.Monad

main = do
  n <- readLn
  as <- map (map read . words) <$> replicateM n getLine
  print $ solve as

solve [] = 0
solve (a:as) = k + solve as
  where
    k = y - x + 1
    a = [x, y]