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