#include <iostream>
using namespace std;
int main()
{
int n, ss, sz;
cin >> n;
int t = 0, mt = 0;
while (n--)
{
cin >> ss >> sz;
if (ss >= 90 && ss <= 140 && sz >= 60 && sz <= 90)
{
t++;
if (t > mt)
mt = t;
}
else
t = 0;
}
cout << mt;
return 0;
}