#include <bits/stdc++.h>
int gcd(int a, int b) { return !b ? a : gcd(b, a % b); }
const double pi = acos(-1.0);
const long long mod = 1e9 + 7;
using namespace std;
int ok = 0;
char s[105];
int a[105], b[105];
int main() {
  int N;
  scanf("%d", &N);
  int t = 0;
  for (int i = 1; i <= N; i++) {
    scanf("%d %d", &a[i], &b[i]);
    if (b[i] - a[i] >= 2) t++;
  }
  printf("%d\n", t);
  return 0;
}
