#include <bits/stdc++.h>
using namespace std;
int main() {
  int T;
  cin >> T;
  int classMaster[8] = {0};
  int amount = 0;
  while (T--) {
    int schedule;
    cin >> schedule;
    for (int i = 0; i < 7; i++) {
      if (schedule % 10) classMaster[i]++;
      amount = max(classMaster[i], amount);
      schedule /= 10;
    }
  }
  cout << amount << endl;
}
