#include <bits/stdc++.h>
using namespace std;
int main() {
  int a[24][60] = {0};
  int n, h, m, ans = 0;
  cin >> n;
  while (n--) {
    cin >> h >> m;
    a[h][m]++;
    if (a[h][m] > ans) ans = a[h][m];
  }
  cout << ans;
}
