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