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