#include <bits/stdc++.h>
using namespace std;
int main() {
  ios::sync_with_stdio(false);
  long int n, i, j, ans = 0, m = 0;
  cin >> n;
  string a;
  vector<string> s;
  for (i = 0; i < n; i++) {
    cin >> a;
    s.push_back(a);
  }
  for (i = 0; i < n; i++) {
    m = 0;
    for (j = 0; j < n; j++) {
      if (s[i] == s[j]) m++;
    }
    if (m > ans) ans = m;
  }
  cout << ans;
}
