#include <bits/stdc++.h>
using namespace std;
int n;
int main() {
  int buffer1, buffer, ans = 0;
  cin >> n;
  for (int i = 0; i < n; i++) {
    cin >> buffer >> buffer1;
    if (buffer1 - buffer > 1) ans++;
  }
  cout << ans;
  return 0;
}
