#include <bits/stdc++.h>
using namespace std;
template <class T>
T __trace(string s, T x) {
  cerr << s << x << endl;
  return x;
}
template <class T>
ostream& operator<<(ostream& os, const vector<T>& v) {
  for (T x : v) os << x << " ";
  return os;
}
template <class T>
istream& operator>>(istream& is, vector<T>& v) {
  for (T& x : v) is >> x;
  return is;
}
void run() {
  long long n;
  cin >> n;
  map<pair<long long, long long>, long long> m;
  long long ans = 0;
  for (long long i = 0; i < (n); i++) {
    long long h, mi;
    cin >> h >> mi;
    m[make_pair(h, mi)]++;
    ans = max(ans, m[make_pair(h, mi)]);
  }
  cout << ans << endl;
}
int main() {
  run();
  return 0;
}
