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