#include <bits/stdc++.h>
using namespace std;
int main() {
  pair<int, int> x[10000];
  int n;
  cin >> n;
  for (int i = 0; i < n; i++) {
    cin >> x[i].first >> x[i].second;
  }
  int count = 0;
  for (int i = 0; i < n; i++) {
    if (x[i].first + 2 <= x[i].second) count++;
  }
  cout << count << endl;
  return 0;
}
