#include <bits/stdc++.h>
using namespace std;
long long a[10000000], n, k = 0, h, m, mx = -1e9;
int main() {
  cin >> n;
  for (int i = 1; i <= n; i++) {
    cin >> h >> m;
    a[i] = h * 60 + m;
  }
  for (int i = 1; i < n; i++) {
    if (a[i] == a[i + 1]) {
      k++;
    } else {
      mx = max(mx, (k + 1));
      k = 0;
    }
  }
  mx = max(mx, (k + 1));
  cout << mx;
}
