#include <bits/stdc++.h>
using namespace std;
int main() {
  long long int n, i, count = 1, ans = 1;
  cin >> n;
  long long int h, m, ch = -1, cm = -1;
  for (i = 0; i < n; i++) {
    cin >> h >> m;
    if (h == ch && m == cm) {
      count++;
      ans = max(ans, count);
    } else {
      count = 1;
      ch = h;
      cm = m;
    }
  }
  cout << ans;
  return 0;
}
