#include <bits/stdc++.h>
using namespace std;
int max(int a, int b) { return (a > b) ? a : b; }
int min(int a, int b) { return (a < b) ? a : b; }
int vv(std::vector<vector<char> > v, int i, int n) {
  for (int j = 0; j < n; j++) {
    if (v[i][j] == '0') {
      for (int k = 0; k < n; k++) v[k][j] = (v[k][j] == '1') ? '0' : '1';
    }
  }
  int z = 0, x = 0;
  for (i = 0; i < n; i++) {
    z = 0;
    for (int j = 0; j < n; j++)
      if (v[i][j] == '1') z++;
    if (z == n) x++;
  }
  return x;
}
int main() {
  std::vector<vector<char> > v(105, vector<char>(105));
  int n, m = 0;
  scanf("%d", &n);
  getchar();
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < n; j++) scanf("%c", &v[i][j]);
    getchar();
  }
  m = 0;
  for (int i = 0; i < n; i++) m = max(m, vv(v, i, n));
  printf("%d\n", m);
  return 0;
}
