#include <bits/stdc++.h>
char map[120][120];
int main() {
  int n;
  while (scanf("%d", &n) != EOF) {
    getchar();
    for (int i = 0; i < n; i++) {
      for (int j = 0; j < n; j++) {
        scanf("%c", &map[i][j]);
      }
      getchar();
    }
    int max = 1;
    for (int i = 0; i < n; i++) {
      int cnt = 1;
      for (int j = i + 1; j < n; j++) {
        int p;
        for (p = 0; p < n; p++) {
          if (map[i][p] != map[j][p]) break;
        }
        if (p >= n) cnt++;
      }
      if (cnt > max) max = cnt;
    }
    printf("%d\n", max);
  }
  return 0;
}
