function main(input) {
  var N = input[0]-0;
  var ans = input.filter((v,i)=>i>0).map(v=>v.split(" ")[1]-v.split(" ")[0]+1).reduce((a,b)=>a+b);
  console.log(ans);
}
main(require('fs').readFileSync('/dev/stdin', 'utf8').trim().split("\n"))
