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

maxNum :: Int
maxNum = 100000

data Seat = Seat Int Int

readPair :: IO Seat
readPair = do
    s <- words <$> getLine
    let [l, r] = map read s :: [Int]
    return (Seat l r)

calcSeats :: Seat -> Int
calcSeats (Seat l r) = r - l + 1

calcTotalSeats :: [Seat] -> Int
calcTotalSeats [] = 0
calcTotalSeats (x:xs) = 
    (calcSeats x) + (calcTotalSeats xs)


main :: IO()
main = do
    n <- readLn :: IO Int
    seats <- replicateM n readPair
    let ans = calcTotalSeats seats
    print ans 
