#include <bits/stdc++.h>
using namespace std;
int main() {
  int ar[105][105];
  string str[105];
  int n;
  int tmp[105][105];
  int max = -1;
  vector<int> v;
  cin >> n;
  for (int i = 0; i < n; i++) cin >> str[i];
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < n; j++) ar[i][j] = str[i][j] - '0';
  }
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < n; j++) tmp[i][j] = ar[i][j];
  }
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < n; j++) {
      if (ar[i][j] == 0) v.push_back(j);
    }
    for (int k = 0; k < v.size(); k++) {
      int x = v[k];
      for (int j = 0; j < n; j++) {
        if (ar[j][x] == 0)
          ar[j][x] = 1;
        else
          ar[j][x] = 0;
      }
    }
    int c = 0;
    int r = 0;
    for (int j = 0; j < n; j++) {
      c = 0;
      for (int k = 0; k < n; k++) {
        if (ar[j][k] == 1) c++;
      }
      if (c == n) r++;
    }
    if (r > max) max = r;
    v.clear();
    for (int j = 0; j < n; j++) {
      for (int k = 0; k < n; k++) {
        ar[j][k] = tmp[j][k];
      }
    }
  }
  cout << max << "\n";
  return 0;
}
