#include <bits/stdc++.h>
using namespace std;
int main() {
  long long int n, flag, run = 0, curr = 0;
  cin >> n;
  string s[1117];
  for (int i = 0; i < n; i++) {
    cin >> s[i];
    if (i == n - 1) {
      for (int h = 0; h < 7; h++) {
        run = 0;
        for (int j = 0; j < n; j++) {
          if (s[j][h] == '1') run++;
        }
        flag = max(flag, run);
      }
    }
  }
  cout << flag << endl;
  return 0;
}
