function main(s) {
	v = s.split("\n");
	x = 0;
	for (i = 1; i <= Number(v[0]); i++) {
		x += Number(v[i].split(" ")[1] - v[i].split(" ")[0] + 1)
	}
	console.log(x);
}
main(require("fs").readFileSync("/dev/stdin", "utf8"));

