#include<iostream>
#include<cstdio>
#include<cmath>
using namespace std;
#define pf printf
#define sf scanf
int main()
{
int n, p, q, count;
sf("%d", &n);
count = 0;
while(n--)
{
sf("%d%d", &p, &q);
if((q-p)>=2)
count++;
}
pf("%d\n", count);
return 0;
}
#include<cstdio>
#include<cmath>
using namespace std;
#define pf printf
#define sf scanf
int main()
{
int n, p, q, count;
sf("%d", &n);
count = 0;
while(n--)
{
sf("%d%d", &p, &q);
if((q-p)>=2)
count++;
}
pf("%d\n", count);
return 0;
}