#include <bits/stdc++.h>
using namespace std;
int main(void) {
  int rooms, p, q, count = 0;
  cin >> rooms;
  for (int i = 0; i < rooms; i++) {
    cin >> p >> q;
    if (p <= (q - 2)) {
      count++;
    }
  }
  cout << count << endl;
  return 0;
}
