#include <bits/stdc++.h>
using namespace std;
int n, h, m,res = 0;
int s[1450];
int main()
{
cin >> n;
while (n --)
{
cin >> h >> m;
s[h * 60 + m] ++;
}
for (int i = 0; i <= 1440; i ++)
{
res = max(res, s[i]);
}
cout << res << endl;
return 0;
}