#include <bits/stdc++.h>
using namespace std;
template <typename T>
vector<T> &operator+=(vector<T> &v, T x) {
  v.push_back(x);
  return v;
}
void solve() {
  int n;
  cin >> n;
  int a[n], b[n];
  int cash = 1, t = 0;
  for (int i = (0), _b_ = (n); i < _b_; i++) {
    cin >> a[i] >> b[i];
    if (i > 0) {
      if (a[i] == a[i - 1] && b[i] == b[i - 1]) {
        t++;
      } else {
        cash = max(cash, t + 1);
        t = 0;
      }
    }
  }
  cout << max(cash, t + 1);
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  solve();
}
