#include <bits/stdc++.h>
using namespace std;
int ans, ret, n, hour[2], mins[2];
int main() {
  scanf("%d", &n);
  ans = 1;
  ret = 1;
  hour[0] = -1;
  mins[0] = -1;
  for (int i = 1; i <= n; i++) {
    scanf("%d %d", &hour[i % 2], &mins[i % 2]);
    if (hour[(i + 1) % 2] == hour[i % 2] && mins[i % 2] == mins[(i + 1) % 2]) {
      ans++;
      ret = max(ret, ans);
    } else {
      ans = 1;
    }
  }
  cout << ret << endl;
  return 0;
}
