#include <bits/stdc++.h>
using namespace std;
pair<int, int> v[100];
int n, ct;
int main() {
  cin >> n;
  for (int i = 0; i < n; i++) {
    cin >> v[i].first >> v[i].second;
    if ((v[i].first + 2) <= v[i].second) ct++;
  }
  cout << ct << endl;
  return 0;
}
