#include <bits/stdc++.h>
using namespace std;
int func(char a[101], char b[101]) {
  for (int i = 0; (a[i] == '1' || a[i] == '0') && (b[i] == '1' || b[i] == '0');
       i++) {
    if (a[i] != b[i]) return 0;
  }
  return 1;
}
int main() {
  char a[101][101];
  int n, f = 0, b[101] = {0}, max = 0, t;
  cin >> n;
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < n; j++) cin >> a[i][j];
  }
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < n; j++)
      if (func(a[i], a[j])) b[i]++;
  }
  for (int i = 0; i < n; i++) {
    if (b[i] > max) {
      max = b[i];
      t = i;
    }
  }
  for (int j = 0; j < n; j++) {
    if (a[t][j] == '1') {
      for (int i = 0; i < n; i++) {
        if (a[i][j] == '1')
          a[i][j] = '0';
        else
          a[i][j] = '1';
      }
    }
  }
  for (int i = 0; i < n; i++) {
    int T = 1;
    for (int j = 0; j < n && T; j++) {
      if (a[i][j] == '1') T = 0;
      if (j == n - 1 && T) f++;
    }
  }
  cout << f << endl;
}
