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