#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, x, y;
  cin >> n;
  int cont = 0;
  for (int i = 0; i < n; i++) {
    scanf("%d%d", &x, &y);
    if (y - x >= 2) cont++;
  }
  cout << cont << endl;
}
