#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  int n, i, j;
  cin >> n;
  int hrs[n], mins[n];
  for (i = 0; i < n; ++i) {
    cin >> hrs[i] >> mins[i];
  }
  int max = 1;
  int count = 0;
  for (i = 0; i < n; ++i) {
    count = 1;
    if (hrs[i] == -1 && mins[i] == -1) {
      continue;
    }
    for (j = i + 1; j < n; ++j) {
      if (hrs[j] == hrs[i] && mins[j] == mins[i]) {
        hrs[j] = -1;
        mins[j] = -1;
        count++;
        continue;
      }
      break;
    }
    if (count > max) {
      max = count;
    }
  }
  cout << max << endl;
  return 0;
}
