module Main where
import Control.Monad
main = do
  n <- read <$> getLine :: IO Int
  answer <- sum <$> forM [1..n] $ do
    l:r:_ <- map read . words <$> getLine 
    return $ r - l + 1 :: IO Int
  print answer
