import Control.Monad
main = do
  n <- readLn
  k <- map (map read . words) <$> replicateM n getLine
  putStrLn .show $ solved k

cho a = a2 - a1 + 1
  where
    [a1, a2] = a

solved:: [[Int]] -> Int
solved n = foldl (+) 0 $ map cho n