#include <bits/stdc++.h>
using namespace std;
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  int n;
  cin >> n;
  int low[n], high[n];
  for (int i = 0; i < n; i++) {
    cin >> low[i] >> high[i];
  }
  int ans = 0;
  for (int i = 0; i < n; i++) {
    if (high[i] - low[i] >= 2) {
      ans++;
    }
  }
  cout << ans;
  return 0;
}
