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