#include <iostream>
using namespace std;

int main()
{
int n;
int i;
int x;
int a;
a=0;
cin >> n;
x=n;
int T[x];
int D[x];

for(i=1;i<=n;i++)
{
    cin>>T[i];
    cin>>D[i];

if (T[i]>=1000000){
        cout<<T[i]<<endl;
}
if (D[i]>=1000000){

        cout<<D[i]<<endl;
}
 if (T[i]<0){

        cout<<T[i]<<endl;
}
if (D[i]<0){
        cout<<D[i]<<endl;
}
}
for (i=1;i<=n;i++){
    if (D[i]<=T[i]){
        a=a++;
    }
}
cout << a << endl;
return 0;
}
