#include <bits/stdc++.h>
using namespace std;
int Mod = 1000000007;
double pi = acos(-1.0);
double eps = 1e-6;
typedef struct {
  int f, t, w, next;
} Edge;
Edge edge[1];
int head[1];
int kNum;
void addEdge(int f, int t, int w) {
  edge[kNum].f = f;
  edge[kNum].t = t;
  edge[kNum].w = w;
  edge[kNum].next = head[f];
  head[f] = kNum++;
}
char num[105][105];
bool visit[105];
int N;
void solve() {
  int ans = 0;
  for (int i = 0; i < N; i++) {
    for (int j = 0; j < N; j++) scanf("%c", &num[i][j]);
    getchar();
  }
  memset(visit, false, sizeof(visit));
  int curV = 0;
  for (int i = 0; i < N; i++) {
    if (visit[i]) continue;
    curV = 1;
    for (int j = i + 1; j < N; j++) {
      for (int k = 0; k < N; k++) {
        if (num[i][k] != num[j][k]) break;
        if (k == N - 1) {
          visit[j] = true;
          curV++;
        }
      }
    }
    ans = ans > curV ? ans : curV;
  }
  cout << ans << endl;
}
int main() {
  while (cin >> N) {
    getchar();
    solve();
  }
  return 0;
}
