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