#include <bits/stdc++.h>
using namespace std;
string a[110];
int main() {
  int n;
  cin >> n;
  for (int i = 0; i < n; i++) cin >> a[i];
  int ans = 0;
  for (int i = 0; i < n; i++) {
    int res = 0;
    for (int j = 0; j < n; j++) {
      bool find = false;
      for (int k = 0; k < n; k++)
        if (a[i][k] != a[j][k]) find = true;
      if (!find) res++;
    }
    ans = max(ans, res);
  }
  cout << ans;
  return 0;
}
