#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, i, j, k, a[102], b[102], r = 0, x, y;
  cin >> n;
  for (i = 0; i < n; i++) {
    cin >> a[i] >> b[i];
    x = b[i] - a[i];
    if (x >= 2) r++;
  }
  cout << r << endl;
  return 0;
}
