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