#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, ohh, omm, hh, mm, cnt, same = 1, mx = 1;
  cin >> n;
  cin >> ohh >> omm;
  for (int i = 1; i < n; i++) {
    cin >> hh >> mm;
    int t = (hh - ohh) * 60 + (mm - omm);
    if (t) {
      ohh = hh;
      omm = mm;
      same = 1;
    } else {
      same++;
      if (mx < same) mx = same;
    }
  }
  cout << mx;
  return 0;
}
