#include <stdio.h>
#include <stack>
#include <math.h>

using namespace std;

int n;

bool rangeCheck(int row,int col){
	if(row >= 0 && row <= n-1 && col >= 0 && col <= n-1)return true;
	return false;
}


int main(){

   int max,tmp,row,col,tmp_row,tmp_col;
   char table[255][256];

   while(true){
	   scanf("%d",&n);
	   if(n == 0)break;

	   for(int i=0; i < n; i++){
		   scanf("%s",table[i]);
	   }

	   max = 0;

	   //?¨???????????????§??????
	   for(int i=0; i < n; i++){
		   tmp = 0;
		   for(int k=0;k < n;k++){
			   if(table[i][k] == '1'){
				   tmp++;
				   if(k == n-1){
					   max = (max >= tmp)?max:tmp;
				   }
			   }
			   else{
				   max = (max >= tmp)?max:tmp;
				   tmp = 0;
			   }
		   }
	   }

	   //?????????????????§??????
	   for(int i=0; i < n; i++){
		   tmp = 0;
		   for(int k= 0; k < n; k++){
			   if(table[k][i] == '1'){
				   tmp++;
				   if(k == n-1){
					   max = (max >= tmp)?max:tmp;
				   }
			   }
			   else{
				   max = (max >= tmp)?max:tmp;
				   tmp = 0;
			   }
		   }
	   }

	   //????????????????????§??????:????§?????????§
	   for(row = 1; row < n;row++){
		   tmp_row = row;
		   col = 0;
		   tmp = 0;
		   while(rangeCheck(tmp_row,col)){
			   if(table[tmp_row][col] == '1'){
				   tmp++;
				   if(rangeCheck(tmp_row-1,col+1) == false){
					   max = (max >= tmp)?max:tmp;
					   tmp = 0;
				   }
			   }
			   else{
				   max = (max >= tmp)?max:tmp;
				   tmp = 0;
			   }
			   tmp_row -= 1;
			   col += 1;
		   }
	   }

	   //????????????????????§??????:????§?????????????
	   for(col = 1;col < n-1; col++){
		   tmp_col = col;
		   row = n-1;
		   tmp = 0;
		   while(rangeCheck(row, tmp_col)){
			   if(table[row][tmp_col] == '1'){
				   tmp++;
				   if(rangeCheck(row-1, tmp_col+1) == false){
					   max = (max >= tmp)?max:tmp;
					  tmp = 0;
				   }
			   }
			   else{
				   max = (max >= tmp)?max:tmp;
				   tmp = 0;
			   }
			   row -= 1;
			   tmp_col += 1;
		   }
	   }

	   //????????????????????§??????:????§?????????§
	   for(row =1; row < n;row++){
		   tmp_row = row;
		   col = n-1;
		   tmp = 0;
		   while(rangeCheck(tmp_row,col)){
			   if(table[tmp_row][col] == '1'){
				   tmp++;
				   if(rangeCheck(tmp_row-1,col-1) == false){
					   max = (max >= tmp)?max:tmp;
					  tmp = 0;
				   }
			   }
			   else{
				   max = (max >= tmp)?max:tmp;
				   tmp = 0;
			   }
			   tmp_row -= 1;
			   col -= 1;
		   }
	   }

	   //????????????????????§??????:????§?????????????
	   for(col = n-2; col > 0; col--){
		   tmp_col = col;
		   row = n-1;
		   tmp = 0;
		   while(rangeCheck(row,tmp_col)){
			   if(table[row][tmp_col] == '1'){
				   tmp++;
				   if(rangeCheck(row-1,tmp_col-1) == false){
					   max = (max >= tmp)?max:tmp;
					  tmp = 0;
				   }
			   }
			   else{
				   max = (max >= tmp)?max:tmp;
				   tmp = 0;
			   }
			   row -= 1;
			   tmp_col -= 1;
		   }
	   }

	   printf("%d\n",max);
   }

    return 0;
}