#include <bits/stdc++.h>
using namespace std;
signed main() {
  ios_base::sync_with_stdio(false);
  int n;
  cin >> n;
  int ans = 0;
  for (int i = (1); i <= (n); i++) {
    int p, q;
    cin >> p >> q;
    ans += q - p >= 2;
  }
  cout << ans << "\n";
  return 0;
}
