#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef unsigned long long int ull;
inline void smax(int &x, int y) { x = max(x, y); }
inline void smin(int &x, int y) { x = min(x, y); }
int main() {
  int n;
  cin >> n;
  vector<string> a(n);
  for (__typeof(n) i = (0) - ((0) > (n)); i != (n) - ((0) > (n));
       i += 1 - 2 * ((0) > (n))) {
    cin >> a[i];
  }
  int maxv = 0;
  for (__typeof(7) i = (0) - ((0) > (7)); i != (7) - ((0) > (7));
       i += 1 - 2 * ((0) > (7))) {
    int cnt = 0;
    for (__typeof(n) j = (0) - ((0) > (n)); j != (n) - ((0) > (n));
         j += 1 - 2 * ((0) > (n))) {
      if (a[j][i] == '1') cnt++;
    }
    if (maxv < cnt) maxv = cnt;
  }
  cout << maxv << endl;
}
