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