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