#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  scanf("%d", &n);
  int b1 = 0, b2 = 0, prev;
  for (int i = 0; i < n; i++) {
    int h, m;
    scanf("%d%d", &h, &m);
    m += h * 60;
    if (i == 0)
      prev = m;
    else {
      if (prev == m) {
        b1++;
      } else {
        prev = m;
        b1 = 0;
      }
    }
    b2 = max(b1, b2);
  }
  printf("%d", b2 + 1);
  return 0;
}
