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