#include <bits/stdc++.h>
using namespace std;
int n, h, m, a[24][61], c;
int main() {
  for (cin >> n; n--;) {
    scanf("%d %d", &h, &m);
    if (++a[h][m] > c) c = a[h][m];
  }
  cout << c;
  return 0;
}
