#include <bits/stdc++.h>
using namespace std;
const int maxn = 111;
int a[maxn][maxn], b[maxn][maxn];
int i, j, k, n, m, ans, sum;
char ch;
bool check(int x) {
  for (int i = 1; i <= n; i++)
    if (!a[x][i]) return false;
  return true;
}
int main() {
  scanf("%d\n", &n);
  for (i = 1; i <= n; i++)
    for (j = 1; j <= n; j++) {
      ch = getchar();
      while (ch != '0' && ch != '1') ch = getchar();
      a[i][j] = ch - '0';
    }
  for (i = 1; i <= n; i++)
    for (j = 1; j <= n; j++) b[i][j] = a[i][j];
  ans = 0;
  for (i = 1; i <= n; i++) {
    for (j = 1; j <= n; j++)
      for (k = 1; k <= n; k++) a[j][k] = b[j][k];
    sum = 0;
    for (j = 1; j <= n; j++)
      if (!a[i][j]) {
        for (k = 1; k <= n; k++) a[k][j] ^= 1;
      }
    for (j = 1; j <= n; j++)
      if (check(j)) sum++;
    ans = max(ans, sum);
  }
  printf("%d\n", ans);
  return 0;
}
