#include <bits/stdc++.h>
using namespace std;
long long int arr[105][105];
long long int marked[105];
int main() {
  ios_base::sync_with_stdio(false);
  long long int n;
  cin >> n;
  cin.ignore();
  for (int i = 0; i < n; i++) {
    string s = "";
    cin >> s;
    for (int j = 0; j < n; j++) {
      arr[i][j] = (int)s[j] - 48;
    }
  }
  long long int ans = 1;
  for (int row = 0; row < n; row++) {
    for (int i = 0; i < n; i++) {
      if (arr[row][i] == 0)
        marked[i] = 1;
      else
        marked[i] = 0;
    }
    long long int cunt = 0;
    for (int i = 0; i < n; i++) {
      long long int tag = 1;
      for (int j = 0; j < n; j++) {
        if (marked[j] == 1 && arr[i][j] == 1) {
          tag = 0;
        } else if (marked[j] == 0 && arr[i][j] == 0) {
          tag = 0;
        }
      }
      if (tag) cunt++;
    }
    if (cunt > ans) ans = cunt;
  }
  cout << ans << endl;
  return 0;
}
