#include <bits/stdc++.h>
using namespace std;
char a[120][120];
int main() {
  map<string, int> mp;
  string t = "";
  int n;
  cin >> n;
  for (int i = 1; i <= n; i++) {
    t = "";
    for (int j = 1; j <= n; j++) {
      cin >> a[i][j];
    }
  }
  int maxe = 0;
  int cnt = 0;
  for (int i = 1; i <= n; i++) {
    t = "";
    for (int j = 1; j <= n; j++) {
      t += a[i][j];
    }
    string g = "";
    cnt = 0;
    for (int j1 = i + 1; j1 <= n; j1++) {
      g = "";
      for (int x = 1; x <= n; x++) {
        g += a[j1][x];
      }
      if (g == t) cnt++;
    }
    maxe = max(cnt, maxe);
    for (int j1 = 1; j1 <= i; j1++) {
      g = "";
      for (int x = 1; x <= n; x++) {
        g += a[j1][x];
      }
      if (g == t) cnt++;
    }
    maxe = max(cnt, maxe);
  }
  cout << maxe;
}
