#include <bits/stdc++.h>
using namespace std;
const long long MOD = 1e9 + 7;
int main() {
  long long N;
  cin >> N;
  long long mat[24][60] = {0}, h, m;
  for (long long i = 0; i < N; i++) {
    cin >> h >> m;
    mat[h][m] += 1;
  }
  long long maxi = 1;
  for (long long i = 0; i < 24; i++) {
    for (long long j = 0; j < 60; j++) {
      maxi = max(mat[i][j], maxi);
    }
  }
  cout << maxi << "\n";
}
