import Control.Applicative( (<$>))
import Control.Monad( replicateM)
import Data.List( foldl')

main = do
    n_ <- readLn::IO Int
    let
	readPair = do
	    [l,r] <- map read . words <$> getLine
	    return (l,r)

    pairs_ <- replicateM n_ readPair 
    print $ foldl' (\v (l,r)->v + r-l+1) 0 pairs_