#include <bits/stdc++.h>
int main(void) {
  int n;
  scanf("%d", &n);
  int pi, qi, count = 0;
  while (n--) {
    scanf("%d %d", &pi, &qi);
    count += qi - pi >= 2;
  }
  printf("%d\n", count);
  return 0;
}
