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