import java.util.*;
import java.lang.*;
import java.io.*;
class Main {
in.nextToken();
return (int) in.nval;
}
Scanner in
= new Scanner
(System.
in); int n = nextInt(), j = 0;
for (int i = n; i > 0; i--) {
int a = nextInt(), b = nextInt();
if (b != a - 1) j++;
}
out.println(j);
out.flush();
}
}
aW1wb3J0IGphdmEudXRpbC4qOwppbXBvcnQgamF2YS5sYW5nLio7CmltcG9ydCBqYXZhLmlvLio7CgpjbGFzcyBNYWluIHsKCXN0YXRpYyBTdHJlYW1Ub2tlbml6ZXIgaW4gPSBuZXcgU3RyZWFtVG9rZW5pemVyKG5ldyBCdWZmZXJlZFJlYWRlcihuZXcgSW5wdXRTdHJlYW1SZWFkZXIoU3lzdGVtLmluKSkpOwoJc3RhdGljIFByaW50V3JpdGVyIG91dCA9IG5ldyBQcmludFdyaXRlcihTeXN0ZW0ub3V0KTsKCXN0YXRpYyBpbnQgbmV4dEludCgpIHRocm93cyBJT0V4Y2VwdGlvbiAgewoJCWluLm5leHRUb2tlbigpOwoJCXJldHVybiAoaW50KSBpbi5udmFsOwoJfQoJcHVibGljIHN0YXRpYyB2b2lkIG1haW4gKFN0cmluZ1tdIGFyZ3MpIHRocm93cyBqYXZhLmxhbmcuRXhjZXB0aW9uIHsKCQlTY2FubmVyIGluID0gbmV3IFNjYW5uZXIoU3lzdGVtLmluKTsKCQlpbnQgbiA9IG5leHRJbnQoKSwgaiA9IDA7CgkJZm9yIChpbnQgaSA9IG47IGkgPiAwOyBpLS0pIHsKCQkJaW50IGEgPSBuZXh0SW50KCksIGIgPSBuZXh0SW50KCk7CgkJCWlmIChiICE9IGEgLSAxKSBqKys7CgkJfQoJCW91dC5wcmludGxuKGopOwoJCW91dC5mbHVzaCgpOwoJfQp9