#include <bits/stdc++.h>
using namespace std;
const int inf = 1e9;
const int N = 1e3 + 123;
const long long inff = 1e18;
int n, m, a[105], b[105];
int main() {
  cin >> n;
  for (int i = 1; i <= n; ++i) {
    cin >> a[i] >> b[i];
  }
  for (int i = 1; i <= n; ++i) {
    if (b[i] - a[i] >= 2) m++;
  }
  cout << m;
  return 0;
}
