#include <bits/stdc++.h>
using namespace std;
const long long MOD = 1000000007;
bool sortinrev(const pair<int, int> &a, const pair<int, int> &b) {
  return a.first > b.first;
}
template <typename T>
inline T Bigmod(T base, T power, T MOD) {
  T ret = 1;
  while (power) {
    if (power & 1) ret = (ret * base) % MOD;
    base = (base * base) % MOD;
    power >>= 1;
  }
  return ret;
}
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  ;
  int n;
  while (cin >> n) {
    int cnt = 0;
    while (n--) {
      int p, q;
      cin >> p >> q;
      if ((q - p) >= 2) cnt++;
    }
    cout << cnt << endl;
  }
  return 0;
}
