#include <bits/stdc++.h>
const int N = 100;
using namespace std;
struct Time {
  int h;
  int m;
};
int main() {
  int n, ans, k;
  Time client1, client2;
  cin >> n;
  client1.m = -1;
  client1.h = -1;
  client2.m = 0;
  client2.h = 0;
  k = 1;
  ans = 1;
  for (int i = 0; i < n; ++i) {
    cin >> client2.h >> client2.m;
    if (client1.h == client2.h && client1.m == client2.m)
      ++k;
    else {
      ans = max(ans, k);
      k = 1;
    }
    client1.h = client2.h;
    client1.m = client2.m;
  }
  ans = max(ans, k);
  cout << ans;
  return 0;
}
