#include <bits/stdc++.h>
using namespace std;
const int INF = ~(1 << 31);
const double pi = acos(-1);
int main() {
  cin.sync_with_stdio(false);
  bool b[300][300];
  memset(b, 0, sizeof(b));
  int n;
  cin >> n;
  for (int i = (0); i < (n); i++)
    for (int a = (0); a < (n); a++) {
      char num;
      cin >> num;
      if (num == '1') b[i][a] = true;
    }
  int mx = 0;
  for (int i = (0); i < (n); i++) {
    bool flip[200];
    memset(flip, 0, sizeof(flip));
    for (int a = (0); a < (n); a++)
      if (!b[i][a]) flip[a] = true;
    int got = 0;
    for (int a = (0); a < (n); a++) {
      bool valid = true;
      for (int c = (0); c < (n); c++) {
        bool is = b[a][c];
        if (flip[c]) {
          if (is)
            is = false;
          else
            is = true;
        }
        if (!is) valid = false;
      }
      if (valid) got++;
    }
    mx = max(got, mx);
  }
  cout << mx << endl;
  return 0;
}
