#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, min = 0, ho = 0, preMin = -1, preHo = -1, cashes = 1, maxCashes = 1;
  cin >> n;
  for (int counter = 0; counter < n; counter++) {
    cin >> ho >> min;
    if (ho == preHo && min == preMin) {
      cashes++;
    } else
      cashes = 1;
    preMin = min;
    preHo = ho;
    maxCashes = (maxCashes < cashes) ? cashes : maxCashes;
  }
  cout << maxCashes;
  return 0;
}
