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