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