#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, i, h[100001], m[100001], cnt = 1, max = 1;
  cin >> n;
  for (i = 0; i < n; i++) {
    cin >> h[i] >> m[i];
  }
  for (i = 0; i < n - 1; i++) {
    if (h[i] == h[i + 1] && m[i] == m[i + 1]) {
      ++cnt;
      continue;
    } else {
      if (cnt > max) {
        max = cnt;
        cnt = 1;
      }
      cnt = 1;
    }
  }
  if (cnt > max) max = cnt;
  cout << max << endl;
}
