#include <bits/stdc++.h>
int main() {
  int n, preh = -1, prem = -1, curh, curm, mxcnt = 0, cnt = 1, i;
  scanf("%d", &n);
  for (i = 1; i <= n; i++) {
    scanf("%d %d", &curh, &curm);
    if (curm == prem && curh == preh)
      cnt++;
    else {
      mxcnt = mxcnt < cnt ? cnt : mxcnt;
      cnt = 1;
    }
    preh = curh;
    prem = curm;
  }
  mxcnt = mxcnt < cnt ? cnt : mxcnt;
  printf("%d\n", mxcnt);
  return 0;
}
