#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  int h[n], m[n];
  for (int i = 0; i < n; i++) {
    cin >> h[i] >> m[i];
  };
  int res = 1;
  int newres = 1;
  for (int i = 0; i < n - 1; i++) {
    if (h[i] == h[i + 1] && m[i] == m[i + 1]) {
      newres++;
      if (i == n - 2 && newres > res) {
        res = newres;
      };
    } else if ((h[i] != h[i + 1] || m[i] != m[i + 1]) && newres > res) {
      res = newres;
      newres = 1;
    } else {
      newres = 1;
    };
  };
  cout << res;
  return 0;
};
