#include <bits/stdc++.h>
using namespace std;
const long long N = 1e5 + 5;
long long arr[100][2];
int32_t main() {
  long long n;
  cin >> n;
  for (long long j = 1; j <= n; j++) {
    for (long long i = 0; i <= 1; i++) {
      cin >> arr[j][i];
    }
  }
  long long left = 0;
  for (long long i = 1; i <= n; i++) {
    if ((arr[i][1] - arr[i][0]) >= 2) left++;
  }
  cout << left;
  return 0;
}
