#include <bits/stdc++.h>
using namespace std;
const int inf = 1000 * 2000 * 1000, MOD = 1000 * 1000 * 1000 + 7;
const long long INF = 1000 * 1LL * 1000000 * 1000 * 1000000;
int n, kol[4];
int ans;
string s[500];
int main() {
  cin >> n;
  for (int i = 0; i < n; i++) {
    cin >> s[i];
  }
  for (int i = 0; i < n; i++) {
    int sum = 0;
    for (int j = i; j < n; j++) {
      bool ok = 1;
      for (int k = 0; k < n; k++) {
        if (s[i][k] != s[j][k]) {
          ok = 0;
          break;
        }
      }
      if (ok) {
        sum++;
      }
    }
    ans = max(ans, sum);
  }
  cout << ans;
  return 0;
}
