#include <bits/stdc++.h>
using namespace std;
void solve() {
  long long n;
  cin >> n;
  vector<string> v;
  for (long long i = 0; i < n; i++) {
    string s;
    cin >> s;
    v.push_back(s);
  }
  long long ans = 0;
  for (long long i = 0; i < n; i++) {
    long long c = 0;
    for (long long j = 0; j < n; j++) {
      if (v[i] == v[j]) {
        c++;
      }
    }
    ans = max(ans, c);
  }
  cout << ans << endl;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  solve();
  return 0;
}
