#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  int x = 0, y = 0, counter = 0;
  for (int i = 0; i < n; i++) {
    cin >> x >> y;
    if (y >= x + 2) counter++;
  }
  cout << counter << endl;
  return 0;
}
