#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  int i, j, k, l;
  cin >> n;
  char a[108][108];
  for (i = 0; i < n; i++) cin >> a[i];
  int val;
  int max = 0;
  for (i = 0; i < n; i++) {
    val = 0;
    for (k = 0; k < n; k++) {
      int m = 1;
      for (j = 0; j < n; j++) {
        if (a[i][j] != a[k][j]) m = 0;
      }
      if (m == 1) val++;
    }
    if (max < val) max = val;
  }
  cout << max << endl;
}
