George and Accommodation from CodeForces
#include <iostream>
using namespace std;
int main(void)
{
int n, count, now, max;
int i;
count = 0;
cin >> n;
if(n >= 1 && n <= 100)
{
for(i = 0; i < n; i++)
{
cin >> now >> max;
if(now <= max && now >= 0 && max >= 0 && now <= 100 && max <= 100)
{
if(max - now >= 2)
{
count++;
}
}
else
{
break;
}
}
}
cout << count;
return 0;
}