#include <bits/stdc++.h>
using namespace std;
const int INF = 1e9;
void _debug() { cerr << "]" << endl; }
template <typename T>
void _debug(T a) {
  cerr << a << ']' << endl;
}
template <typename T, typename... Args>
void _debug(T a, Args... args) {
  cerr << a << ", ";
  _debug(args...);
}
template <typename T>
void read(T &a) {
  cin >> a;
}
template <typename T, typename... Args>
void read(T &a, Args &...args) {
  cin >> a;
  read(args...);
}
void solve() {
  int n;
  cin >> n;
  vector<string> v(n);
  for (int i = 0; i < (n); ++i) cin >> v[i];
  int res = 0;
  for (int row = 0; row < (n); ++row) {
    auto t = v;
    for (int col = 0; col < (n); ++col) {
      if (v[row][col] == '0') {
        for (int r = 0; r < (n); ++r) {
          t[r][col] = (t[r][col] == '0' ? '1' : '0');
        }
      }
    }
    int cnt = 0;
    for (int r = 0; r < (n); ++r) {
      bool ok = true;
      for (int c = 0; c < (n); ++c) {
        ok &= t[r][c] == '1';
      }
      cnt += ok;
    }
    res = max(res, cnt);
  }
  cout << res;
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  solve();
  cout << flush;
}
