#include <bits/stdc++.h>
using namespace std;
map<int, int> c;
int n;
int main() {
  while (scanf("%d", &n) != EOF) {
    c.clear();
    int maxv = 0;
    while (n--) {
      int x, y;
      scanf("%d %d", &x, &y);
      c[x * 60 + y]++;
      maxv = max(maxv, c[x * 60 + y]);
    }
    printf("%d\n", maxv);
  }
  return 0;
}
