#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  int n = 0;
  cin >> n;
  int v[n][n];
  char temp;
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < n; j++) {
      cin >> temp;
      v[i][j] = (int)temp - '0';
    }
  }
  long long mx = -1;
  for (int i = 0; i < n; i++) {
    long long ans = 0;
    for (int j = 0; j < n; j++) {
      int found = 1;
      for (int k = 0; k < n; k++) {
        if (v[i][k] != v[j][k]) found = 0;
      }
      if (found) ans++;
    }
    mx = max(mx, ans);
  }
  cout << mx << endl;
  return 0;
}
