#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  char mat[100][101];
  int *ordine, *ordineBis;
  scanf("%d", &n);
  ordine = new int[n];
  ordineBis = new int[n];
  int *aux;
  for (int i = 0; i < n; i++) {
    scanf("%s", mat[i]);
    ordine[i] = i;
  }
  for (int i = n - 1; i >= 0; i--) {
    int conta0 = 0;
    int base = 0;
    for (int j = 0; j < n; j++) conta0 += 1 - mat[j][i] + '0';
    for (int j = 0; j < n; j++)
      if (mat[ordine[j]][i] == '1')
        ordineBis[conta0++] = ordine[j];
      else
        ordineBis[base++] = ordine[j];
    aux = ordine;
    ordine = ordineBis;
    ordineBis = aux;
  }
  int nUguali = 1;
  int nMax = 1;
  for (int i = 1; i < n; i++) {
    if (strcmp(mat[ordine[i]], mat[ordine[i - 1]]) == 0) {
      nUguali++;
      if (nUguali > nMax) nMax = nUguali;
    } else
      nUguali = 1;
  }
  printf("%d", nMax);
  return 0;
}
