#include <bits/stdc++.h>
using namespace std;
int a[24][60];
int main() {
  int n, x, y;
  cin >> n;
  for (int i = 0; i < n; i++) {
    cin >> x >> y;
    a[x][y]++;
  }
  int mx = a[0][0];
  for (int i = 0; i < 24; i++) {
    for (int j = 0; j < 60; j++) {
      if (a[i][j] > mx) mx = a[i][j];
    }
  }
  cout << mx << endl;
  return 0;
}
