#include <bits/stdc++.h>
int main() {
  int p, q, n, i, j, count = 0;
  scanf("%d", &n);
  char room[n][2];
  for (i = 0; i < n; i++) {
    for (j = 0; j < 2; j++) {
      scanf("%d", &room[i][j]);
    }
  }
  for (i = 0; i < n; i++) {
    if (room[i][1] - room[i][0] > 1) {
      count++;
    }
  }
  printf("%d", count);
}
