#include <bits/stdc++.h>
using namespace std;
int main() {
  int t;
  cin >> t;
  int rooms = 0;
  int p, q;
  while (t--) {
    scanf("%d %d", &p, &q);
    if (q - p >= 2) rooms++;
  }
  cout << rooms << endl;
  return 0;
}
