#include <bits/stdc++.h>
using namespace std;
const int N = 105;
int n, ans;
char a[N][N], b[N][N];
int main() {
  scanf("%d\n", &n);
  for (int i = 1; i <= n; i++) scanf("%s\n", a[i] + 1);
  for (int r = 1; r <= n; r++) {
    for (int i = 1; i <= n; i++)
      for (int j = 1; j <= n; j++) b[i][j] = a[i][j];
    for (int j = 1; j <= n; j++)
      if (b[r][j] == '0') {
        for (int i = 1; i <= n; i++) b[i][j] = b[i][j] == '0' ? '1' : '0';
      }
    int sum = 0;
    for (int i = 1; i <= n; i++) {
      int ok = 1;
      for (int j = 1; j <= n; j++)
        if (b[i][j] == '0') ok = 0;
      sum += ok;
    }
    ans = max(ans, sum);
  }
  cout << ans;
  return 0;
}
