#include <bits/stdc++.h>
using namespace std;
void fast_in_out() {
  std::ios_base::sync_with_stdio(NULL);
  cin.tie(NULL);
  cout.tie(NULL);
}
int main() {
  fast_in_out();
  int n, x, y, c = 0;
  cin >> n;
  for (int(i) = 0; (i) < (n); ++(i)) {
    cin >> x >> y;
    if (y >= x + 2) c++;
  }
  cout << c << endl;
  return 0;
}
