#include <iostream>
using namespace std;
int main() {
unsigned int n;
cin >> n;
unsigned int a, b, j = 0;
for (n; n > 0; n--) {
cin >> a >> b;
if (b != a - 1) j++;
}
cout << j;
return 0;
}
I2luY2x1ZGUgPGlvc3RyZWFtPgp1c2luZyBuYW1lc3BhY2Ugc3RkOwoKaW50IG1haW4oKSB7Cgl1bnNpZ25lZCBpbnQgbjsKCWNpbiA+PiBuOwoJdW5zaWduZWQgaW50IGEsIGIsIGogPSAwOwoJZm9yIChuOyBuID4gMDsgbi0tKSB7CgkJY2luID4+IGEgPj4gYjsKCQlpZiAoYiAhPSBhIC0gMSkgaisrOwoJfQoJY291dCA8PCBqOwoJCglyZXR1cm4gMDsKfQ==