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

-- String, Int, Char, IO

-- e.g.
-- 1
-- [a] <- map read . words <$> getLine => [1] -> a == 1
-- 1
-- a <- readLn
-- 1 2 3
-- lst <- map read . words <$> getLine => [1, 2, 3]
-- 1 2 3
-- [l, m, n] <- map read . words <$. getLine :: IO [Int] => [1, 2, 3]
-- 'a'
-- c <- getChar => c == 'a'


getPair :: IO (Int, Int)
getPair = do
  [a, b] <- map read . words <$> getLine
  return (a, b)


main :: IO()
main = do
  n <- readLn :: IO Int
  lst <- replicateM n getPair
  print $ foldl (\n -> \(a, b) -> b-a+1 + n) 0 lst

  
