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