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