#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  string s[n + 1];
  for (int i = 0; i <= n; i++) {
    getline(cin, s[i]);
  }
  int a[1000] = {0};
  map<string, int> m;
  for (int i = 1; i <= n; i++) {
    m[s[i]]++;
  }
  int maxx = 0;
  for (int i = 1; i <= n; i++) {
    maxx = max(maxx, m[s[i]]);
  }
  cout << maxx << endl;
}
