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