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