#include <bits/stdc++.h>
using namespace std;
int nod(int x, int y) {
  if (y == 0) return x;
  return nod(y, x % y);
}
void swap(vector<int>& v, int i, int j) {
  int temp = v[i];
  v[i] = v[j];
  v[j] = temp;
}
int main() {
  int n, h, m;
  cin >> n;
  pair<int, int> p;
  p.first = 25;
  int count = 0;
  int cm = 0;
  for (int i = 0; i < n; ++i) {
    cin >> h >> m;
    if (h == p.first && m == p.second) {
      ++count;
    } else {
      if (count > cm) {
        cm = count;
      }
      count = 0;
      p.first = h;
      p.second = m;
    }
  }
  if (count > cm) {
    cm = count;
  }
  cout << cm + 1;
  return 0;
}
