#include <bits/stdc++.h>
using namespace std;
int cmpLToS(int a, int b) { return a > b; }
int cmpSToL(int a, int b) { return b > a; }
void CFNow() {
  int n;
  cin >> n;
  int nCount = 0;
  while (n--) {
    int p, q;
    cin >> p >> q;
    if (q - p >= 2) nCount++;
  }
  cout << nCount << endl;
}
int main() {
  CFNow();
  return 0;
}
