'use strict'
 
function Main(input) {
  const inputs = input.split('\n');
  const n = inputs[0];
  const lines = inputs.slice(1);
 
  let sum = 0;
  lines.map(line => {
    const nums = line.split(' ').map(n => Number(n));
    sum += (nums[1] - nums[0]) + 1;
  });
  console.log('%d', sum);
}
 
Main(require("fs").readFileSync("/dev/stdin", "utf8"));