#include <bits/stdc++.h>
using namespace std;
int main() {
  long long n, ans = 1, ans1 = 0, ans2 = 0, c[100001], b[100001], a[100001];
  cin >> n;
  for (long long i = 0; i < n; i++) {
    cin >> a[i] >> b[i];
    if (a[i] == 0) {
      a[i] = 3;
    }
    if (b[i] == 0) {
      b[i] = 3;
    }
  }
  for (long long i = 0; i < n; i++) {
    if (a[i] == a[i + 1] && b[i] == b[i + 1]) {
      ans++;
    } else {
      c[ans1] = ans;
      ans1++;
      ans = 1;
    }
  }
  for (long long i = 0; i <= ans1; i++) {
    if (c[i] > ans2) {
      ans2 = c[i];
    }
  }
  cout << ans2;
}
