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