import Data.List
import Data.Ord
import Data.Char
import Data.Ratio
import Data.Maybe

main = do
  getLine
  s <- map (map (read::String->Int)) . map words . lines <$> getContents
  print $sum $map f s
f [x,y] = y-x+1