#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, answer = 0;
  cin >> n;
  string s[n];
  for (auto i = (0); i < (n); i++) {
    cin >> s[i];
  }
  for (auto i = (0); i < (n); i++) {
    int count = 1;
    for (auto j = (0); j < (n); j++) {
      if (i != j) {
        if (s[i].compare(s[j]) == 0) count++;
      }
    }
    answer = max(count, answer);
  }
  cout << answer;
}
