#include <bits/stdc++.h>
using namespace std;
void solution() {}
int main() {
  int n, c = 0;
  cin >> n;
  while (n) {
    int p, q;
    cin >> p >> q;
    if (q - p >= 2) {
      c++;
    }
    n--;
  }
  cout << c;
  return 0;
}
