#include <bits/stdc++.h>
using namespace std;
struct student {
  int ac1;
  int ac2;
  int ac3;
} ac[105];
int a[150];
int main() {
  int n, sum = 0, sum1 = 0, sum2 = 0, sum3 = 0;
  cin >> n;
  for (int i = 0; i < n; i++) {
    cin >> ac[i].ac1 >> ac[i].ac2;
  }
  for (int i = 0; i < n; i++) {
    if (ac[i].ac2 - ac[i].ac1 >= 2) {
      sum++;
    }
  }
  cout << sum << endl;
  return 0;
}
