#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, a, count = 0;
  int max = 0;
  cin >> n;
  int *x = new int[n * 2];
  for (int i = 0; i < n * 2; i++) {
    cin >> a;
    x[i] = a;
  }
  for (int i = 0; i < (n * 2) - 2; i = i + 2) {
    if (x[i] == x[i + 2]) {
      if (x[i + 1] == x[i + 3]) {
        count++;
      }
    } else {
      count = 0;
    }
    if (x[i] != x[i + 2] || x[i + 1] != x[i + 3]) {
      count = 0;
    }
    if (count > max) {
      max = count;
    }
  }
  cout << max + 1 << endl;
  return 0;
}
