#include <bits/stdc++.h>
using namespace std;
bool isEqual(pair<int, int> p1, pair<int, int> p2) {
  if (p1.first == p2.first && p1.second == p2.second) return true;
  return false;
}
int isLast(int count, int max) {
  if (count > max) max = count;
  return max;
}
void solve() {
  int n;
  cin >> n;
  vector<pair<int, int> > vt;
  for (int i = 0; i < n; i++) {
    int a, b;
    cin >> a >> b;
    vt.push_back({a, b});
  }
  int id = 0, flag = 1, count = 0, max = -99;
  pair<int, int> tmp;
  for (auto p : vt) {
    if (id == 0) {
      tmp = p;
      id++;
      count++;
      max = isLast(count, max);
    } else if (isEqual(tmp, p) && flag == 1) {
      count++;
      max = isLast(count, max);
    } else if (flag == 0 && isEqual(tmp, p)) {
      count++;
      flag = 1;
      max = isLast(count, max);
    } else if (!isEqual(tmp, p)) {
      max = isLast(count, max);
      if (flag == 1) {
        flag = 0;
      } else if (flag == 0) {
        flag = 1;
      }
      count = 1;
      tmp = p;
    }
  }
  cout << max << endl;
}
int main() {
  solve();
  return 0;
}
