#include <bits/stdc++.h>
using namespace std;
int n, m;
int b[111111];
int main() {
  scanf("%d", &n);
  for (int i = 0; i < (n); ++i) {
    int x, y;
    scanf("%d%d", &x, &y);
    b[x * 60 + y]++;
  }
  cout << *max_element(b, b + 111111) << endl;
}
