#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  vector<vector<int>> v;
  v.resize(n, vector<int>(7));
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < 7; j++) {
      scanf("%1d", &v[i][j]);
    }
  }
  int max_rooms = 0, cur = 0;
  for (int i = 0; i < 7; i++) {
    for (int j = 0; j < n; j++) {
      cur += v[j][i];
    }
    max_rooms = max(max_rooms, cur);
    cur = 0;
  }
  cout << max_rooms << endl;
  return 0;
}
