#include <bits/stdc++.h>
const int N = (int)1e6 + 123;
const long long inf = (long long)1e18 + 123;
const double eps = 1e-6;
using namespace std;
int a[100011], b[100011], cnt;
int main() {
  int n;
  cin >> n;
  for (int i = 1; i <= n; i++) {
    cin >> a[i] >> b[i];
    if (b[i] - a[i] >= 2) {
      cnt++;
    }
  }
  cout << cnt;
  return 0;
}
