#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, maxx = 1;
  cin >> n;
  int c = 1;
  int hourpast = -1, minutepast = -1, hnew, mnew;
  for (int i = 0; i < n; i++) {
    cin >> hnew >> mnew;
    if (hnew == hourpast && mnew == minutepast) {
      c++;
    } else {
      maxx = max(maxx, c);
      c = 1;
    }
    hourpast = hnew;
    minutepast = mnew;
  }
  maxx = max(maxx, c);
  cout << maxx << endl;
  return 0;
}
