module Main where

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

main :: IO ()
main = do
    n <- readLn
    xss <- replicateM n $ fmap read . words <$> getLine :: IO [[Int]]
    let f [l, r] = r - l + 1
    print $ sum $ fmap f xss