#include <bits/stdc++.h>
using namespace std;
int n;
int a[111][111];
int b[111];
int c[111];
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cin >> n;
  for (int i = 0; i < n; ++i) {
    for (int j = 0; j < n; ++j) {
      char ss;
      cin >> ss;
      a[i][j] = ss - '0';
      if (ss == '1') {
        b[i]++;
      }
    }
  }
  int result = 0;
  for (int i = 0; i < n; ++i) {
    for (int j = 0; j < n; ++j) {
      c[j] = b[j];
    }
    for (int j = 0; j < n; ++j) {
      if (a[i][j] == 0) continue;
      for (int k = 0; k < n; ++k) {
        if (a[k][j] == 1) {
          c[k]--;
        } else {
          c[k]++;
        }
      }
    }
    int prom = 0;
    for (int j = 0; j < n; ++j) {
      if (c[j] == 0) prom++;
    }
    result = max(result, prom);
  }
  cout << result;
  return 0;
}
