#include <bits/stdc++.h>
using namespace std;
int main(void) {
  int n, total = 0;
  cin >> n;
  while (n--) {
    int a, b;
    cin >> a >> b;
    if (b - a >= 2) total++;
  }
  cout << total << endl;
  return 0;
}
