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