-- Question B

import Data.List
import Control.Applicative
import Control.Monad

main = do
	n <- readLn ::IO Int
	xs <- map (map read . words) . lines <$> getContents 
	putStrLn $ show (check xs)

check :: [[Int]] -> Int
check xs = sum [ x-y+1 | [x,y] <- xs ]