#include <bits/stdc++.h>
using namespace std;
int main() {
  int N, h, m;
  int maxNum = 0, currNum = 0, currH = 0, currM = 0;
  cin >> N;
  for (int i = 0; i < N; ++i) {
    cin >> h >> m;
    if (currNum == 0) {
      currH = h;
      currM = m;
      currNum++;
    } else {
      if (currH == h && currM == m) {
        currNum++;
      } else {
        if (maxNum < currNum) {
          maxNum = currNum;
        }
        currNum = 1;
        currH = h;
        currM = m;
      }
    }
  }
  if (maxNum < currNum) {
    maxNum = currNum;
  }
  cout << maxNum << "\n";
  return 0;
}
