#include <bits/stdc++.h>
using namespace std;
bool checker(long a[], long b[], int n) {
  bool ch = true;
  for (int i = 1; i < n + 1; i++) {
    if (a[i] != a[i - 1] || b[i - 1] != b[i]) ch = false;
  }
  return ch;
}
int main() {
  int n;
  cin >> n;
  int t = 1;
  int p = 0;
  int count[100000];
  count[0] = 1;
  count[t] = 1;
  long h[100000];
  long m[100000];
  for (int i = 0; i < n; i++) {
    cin >> h[i] >> m[i];
  }
  if (n == 1) {
    cout << 1;
    return 0;
  }
  for (int i = 1; i < n + 1; i++) {
    if (h[i - 1] == h[i] && m[i - 1] == m[i])
      count[t]++;
    else if (h[i - 1] != h[i] || m[i - 1] != m[i]) {
      t = t + 1;
      count[t] = 1;
    }
  }
  int max = count[0];
  for (int j = 0; j < n + 1; j++) {
    if (count[j] >= max) {
      max = count[j];
    }
  }
  if (checker(h, m, n)) {
    cout << n;
  } else {
    cout << max;
  }
  return 0;
}
