#include <bits/stdc++.h>
using namespace std;
const int MAX = 1005;
map<pair<int, int>, int> mapa;
int main() {
  int n, h, m;
  scanf("%d", &n);
  int c = 0;
  for (int i = 0; i < n; i++) {
    scanf("%d%d", &h, &m);
    int x = ++mapa[make_pair(h, m)];
    if (x > c) c = x;
  }
  printf("%d\n", c);
  return 0;
}
