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