#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, i, j;
  cin >> n;
  char arr[100][100];
  for (i = 0; i < n; i++) {
    cin >> arr[i];
  }
  int maxi = 0;
  for (i = 0; i < n; i++) {
    int p = 1;
    for (j = i + 1; j < n; j++) {
      int x;
      for (x = 0; x < n; x++) {
        if (arr[i][x] != arr[j][x]) break;
      }
      if (x == n) p++;
    }
    if (p > maxi) maxi = p;
  }
  cout << maxi << endl;
  return 0;
}
