#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, ans = 0;
  scanf("%d", &n);
  for (int i = 1; i <= n; i++) {
    int x, y;
    scanf("%d %d", &x, &y);
    if (y - x >= 2) ans++;
  }
  printf("%d\n", ans);
  return 0;
}
