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