#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, x, y, h, m, counter = 1;
  vector<int> v;
  cin >> n;
  if (n == 1) {
    cin >> h >> m;
    cout << counter << endl;
  } else {
    for (int i = 0; i < n; i++) {
      cin >> h >> m;
      if (i == 0) {
        x = h;
        y = m;
      } else if (i == (n - 1)) {
        if (x == h && y == m) {
          counter++;
          v.push_back(counter);
        } else {
          v.push_back(counter);
          counter = 1;
          v.push_back(counter);
        }
      } else {
        if (x == h && y == m) {
          counter++;
          x = h;
          y = m;
        } else {
          v.push_back(counter);
          x = h;
          y = m;
          counter = 1;
        }
      }
    }
    sort(v.rbegin(), v.rend());
    cout << v[0] << endl;
  }
}
