#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, h0, m0, h, m, maxi = 0, nb_cash = 0;
  cin >> n;
  cin >> h0 >> m0;
  for (int i = 1; i < n; i++) {
    cin >> h >> m;
    if (m == m0) {
      nb_cash++;
      maxi = max(maxi, nb_cash);
    } else
      nb_cash = 0;
    m0 = m;
  }
  cout << maxi + 1 << endl;
  return 0;
}
