#include <bits/stdc++.h>
using namespace std;
int n, h, m;
int vis[25][65];
int main() {
  scanf("%d", &n);
  memset(vis, 0, sizeof(vis));
  for (int i = 0; i < (int)n; ++i) {
    scanf("%d %d", &h, &m);
    vis[h][m]++;
  }
  int ans = 1;
  for (int i = (int)0; i <= (int)23; ++i)
    for (int j = (int)0; j <= (int)59; ++j) {
      ans = max(ans, vis[i][j]);
    }
  printf("%d\n", ans);
  return 0;
}
