import Control.Applicative
import Control.Monad
import Data.List
import Data.Array
import Data.Char

main = do
  n <- (read::String -> Int) <$> getLine
  intervals <- forM [1..n] (\i -> do
    [a, b] <- map (read::String -> Int) . words <$> getLine
    return (a, b))
  print $ foldl (\acc (l, r) -> acc + r - l + 1) 0 intervals
