#include <bits/stdc++.h>
using namespace std;
int N;
char grid[102][102];
int main() {
  cin >> N;
  for (int i = 0; i < N; i++)
    for (int j = 0; j < N; j++) cin >> grid[i][j];
  int ans = 0;
  for (int i = 0; i < N; i++) {
    vector<int> idd;
    for (int j = 0; j < N; j++) {
      if (grid[i][j] == '0') idd.push_back(j);
    }
    for (int j = 0; j < idd.size(); j++) {
      for (int k = 0; k < N; k++)
        grid[k][idd[j]] = grid[k][idd[j]] == '1' ? '0' : '1';
    }
    int ccc = 0;
    for (int k1 = 0; k1 < N; k1++) {
      int cnt = 0;
      for (int k2 = 0; k2 < N; k2++) {
        if (grid[k1][k2] == '1') cnt++;
      }
      if (cnt == N) ccc++;
    }
    ans = max(ans, ccc);
    for (int j = 0; j < idd.size(); j++) {
      for (int k = 0; k < N; k++)
        grid[k][idd[j]] = grid[k][idd[j]] == '1' ? '0' : '1';
    }
  }
  cout << ans << "\n";
  return 0;
}
