#include <bits/stdc++.h>
int main() {
  int n, p, q, check;
  std::cin >> n;
  int count = 0;
  while (n--) {
    std::cin >> p >> q;
    check = (q - p);
    if (check >= 2) {
      count++;
    }
  }
  std::cout << count << "\n";
}
