"use strict"

function main(input) {
  input = input.split(/\n/).map(v => v.split(" ").map(v => ~~v))
  const N = input[0][0]
  const groups = input.slice(1, input.length)
  let ans = 0
  for (let i = 0; i < N; i++) {
    ans += groups[i][1] - groups[i][0] + 1
  }
  console.log(ans)
}
main(require("fs").readFileSync("/dev/stdin", "utf8"))
