'use strict'

function main(s) {
  
  const seqs = s.split('\n').slice(1, -1).map(el => el.split(' ').map(num => Number(num)));

  let ans = 0;
  for (const seq of seqs) {
    let num = seq[1] - (seq[0] - 1);
    ans += num;
  }

  console.log(ans);
}

main(require("fs").readFileSync("/dev/stdin", "utf8"));
