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