import Control.Monad
import Data.Maybe
import qualified Data.ByteString.Char8 as B

main = do
    n <- read <$> getLine :: IO Int
    ns <- replicateM n ((\[a,b]->(b-a)+1) . map (fst . fromJust . B.readInt) . B.words <$> B.getLine) :: IO [Int]
    print $ sum ns
