#include <bits/stdc++.h>
using namespace std;
int n, ans;
map<vector<int>, int> mop;
char x;
int main() {
  cin >> n;
  for (int i = 0; i < n; i++) {
    vector<int> v;
    for (int j = 0; j < n; j++) {
      cin >> x;
      if (x == '0') v.push_back(j);
    }
    mop[v]++;
  }
  for (auto i : mop) ans = max(ans, i.second);
  cout << ans;
  return 0;
}
