#include <bits/stdc++.h>
int main() {
  int n, h, m, tmp, len = 1, max = 1;
  scanf("%d", &n);
  scanf("%d %d", &h, &m);
  tmp = h * 60 + m;
  for (int i = 1; i < n; ++i) {
    scanf("%d %d", &h, &m);
    if (tmp == h * 60 + m) {
      len++;
      max = (max > len ? max : len);
    } else {
      tmp = h * 60 + m;
      len = 1;
    }
  }
  printf("%d\n", max);
  return 0;
}
