"use strict";
    
const main = arg => {
    const N  = arg.split("\n")[0];
    const lr = arg.split("\n").slice(1, N + 1);
    let answer = 0;
    
    for(let i in lr) {
        answer += lr[i].split(" ")[1] - lr[i].split(" ")[0] + 1;
    }
    
    console.log(answer);
}
main(require('fs').readFileSync('/dev/stdin', 'utf8'));