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

rInt = read :: String -> Int

main = do
    n <- rInt <$> getLine
    t <- map ((\[l, r] -> r - l + 1) . (map rInt) . words) <$> replicateM n getLine
    print $ sum t