#include <bits/stdc++.h>
using namespace std;
const int maxn = 128;
char s[maxn][maxn], b[maxn][maxn];
int n, ans;
char rev(char x) {
  if (x == '0')
    return '1';
  else
    return '0';
}
int main() {
  if (fopen("input.txt", "r")) {
    freopen("input.txt", "r", stdin);
  }
  cin >> n;
  for (int i = 0; i < n; i++) {
    cin >> s[i];
  }
  for (int i = 0; i < n; i++) {
    memcpy(b, s, sizeof(s));
    for (int j = 0; j < n; j++) {
      if (b[i][j] != '1') {
        for (int k = 0; k < n; k++) b[k][j] = rev(b[k][j]);
      }
    }
    int t = 0;
    for (int j = 0; j < n; j++) {
      int f = 1;
      for (int k = 0; k < n; k++)
        if (b[j][k] != '1') f = 0;
      t += f;
    }
    ans = max(ans, t);
  }
  cout << ans << endl;
  return 0;
}
