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