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