void main() {
    int n = readln.chomp.to!int;
    int people;
    foreach (i; 0 .. n) {
        int[] tmp = readln.split.to!(int[]);
        int l = tmp[0], r = tmp[1];
        people += r - l + 1;
    }
    people.writeln;
}

import std.stdio;
import std.string;
import std.array;
import std.conv;
import std.algorithm;
import std.range;
import std.math;
import std.numeric;
import std.container;
import std.typecons;
import std.ascii;
import std.uni;