import           Control.Applicative
import           Control.Monad

main :: IO ()
main = do
  n  <- readLn
  ls <- replicateM n $ map read . words <$> getLine

  print $ sum $ map f ls

f :: [Int] -> Int
f (a : b : _) = b - a + 1
