#include <bits/stdc++.h>
using namespace std;
int main() {
  int a;
  cin >> a;
  int p, q;
  int count = 0;
  for (int i = 0; i < a; i++) {
    cin >> p >> q;
    if (q - p > 1) {
      count = count + 1;
    }
  }
  cout << count;
}
