#include <bits/stdc++.h>
using namespace std;

int n;

int getMax(vector< vector<int> > f){
  int ma = 0;
  for(int i=0; i < n; i++){
    for(int j=0; j < n; j++){
      ma = max(ma, f[i][j]);
    }
  }
  return ma;
}

int main(void){
  while(cin >> n, n){
    vector< vector <int> > table(n, vector<int>(n));
    for(int i=0; i < n; i++){
      string tmp;
      cin >> tmp;
      for(int j=0; j < n; j++){
        table[i][j] = tmp[j] - '0';
      }
    }

    vector< vector <int> > h  = table;
    vector< vector <int> > v  = table;
    vector< vector <int> > l1 = table;
    vector< vector <int> > l2 = table;


    for(int p = 0; p < n; p++){
      for(int q = 1; q < n; q++){
        if(table[p][q] == 1){
          h[p][q] = h[p][q-1] + 1;
        }
      }
    }
    for(int p = 1; p < n; p++){
      for(int q = 0; q < n; q++){
        if(table[p][q] == 1){
          v[p][q] = v[p-1][q] + 1;
        }
      }
    }
    for(int p = 1; p < n; p++){
      for(int q = 1; q < n; q++){
        if(table[p][q] == 1){
          l1[p][q] = l1[p-1][q-1] + 1;
        }
      }
    }
    for(int p = 1; p < n; p++){
      for(int q = 0; q < n-1; q++){
        if(table[p][q] == 1){
          l2[p][q] = l2[p-1][q+1] + 1;
        }
      }
    }

    vector<int> kouho(4, 0);
    kouho[0] = getMax(h); 
    kouho[1] = getMax(v); 
    kouho[2] = getMax(l1); 
    kouho[3] = getMax(l2); 

    cout << *max_element(kouho.begin(), kouho.end()) << endl;

  }
  return 0;
}