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

myRead :: String -> (Int, Int)
myRead s = (l, r)
    where
        [a, b] = splitOn " " s
        l = read a
        r = read b

solve :: [(Int, Int)] -> Int
solve = sum . ( map (\(l, r) -> r-l+1) )

main :: IO ()
main = do
    n <- read <$> getLine
    contents <- map myRead <$> replicateM n getLine
    print $ solve contents
