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