#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  int *a = new int[n * 2];
  for (int x = 0; x < n * 2; x++) {
    cin >> a[x];
  }
  int w = 0;
  for (int x = 0; x < n * 2; x += 2) {
    if (a[x + 1] - a[x] >= 2) {
      w++;
    }
  }
  cout << w;
  return 0;
  return 0;
}
