#include <bits/stdc++.h>
using namespace std;
int n, ans, h[100005], m[100005];
int main() {
  scanf("%d", &n);
  for (int i = 1; i <= n; i++) scanf("%d %d", &h[i], &m[i]);
  for (int i = 1; i <= n;) {
    int j = i;
    while (j < n && h[j + 1] == h[i] && m[j + 1] == m[j]) j++;
    ans = max(ans, j - i + 1);
    i = j + 1;
  }
  printf("%d\n", ans);
  return 0;
}
