#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  int hours, minutes;
  int lastHours = 24;
  int lastMinutes = 60;
  int nbCashes = 1;
  int courrant = 1;
  cin >> n;
  for (int i = 0; i < n; i++) {
    cin >> hours >> minutes;
    if (hours == lastHours && minutes == lastMinutes) {
      courrant += 1;
      if (courrant > nbCashes) {
        nbCashes = courrant;
      }
    } else {
      courrant = 1;
    }
    lastHours = hours;
    lastMinutes = minutes;
  }
  cout << nbCashes;
  return 0;
}
