#include <bits/stdc++.h>
using namespace std;
long long n, h1, m1, h2, m2, cnt = 1, ccnt = 1;
int main() {
  ios::sync_with_stdio(false), cin.tie(0), cout.tie(0);
  cin >> n;
  cin >> h1 >> m1, n--;
  while (n--) {
    cin >> h2 >> m2;
    if (h2 == h1 && m1 == m2)
      ccnt++;
    else {
      cnt = max(cnt, ccnt);
      ccnt = 1;
      h1 = h2, m1 = m2;
    }
  }
  cnt = max(cnt, ccnt);
  cout << cnt;
}
