#include<iostream>
using namespace std;
int main(int arac,char**argv)
{
int n,ss,sz,maxs=0;
int sum=0;
cin>>n;
for(int i=1;i<=n;i++)
{
cin>>ss>>sz;
if((ss>=90&&ss<=140)&&(sz>=60&&sz<=90))
{
sum++;
}else
{
if(maxs<sum)
{
maxs=sum;
}
sum=0;
}
}
if(maxs<sum)
{
maxs=sum;
}
cout<<maxs;
return 0;
}