main = do
  contents <- getContents
  let ls = tail $ lines contents
  let lss = map words ls
  print $ foldl1 (+) $ map mkNum lss

mkNum :: [String] -> Int
mkNum (x:y:_) = (rInt y) - (rInt x) + 1

rInt :: String -> Int
rInt = read
