#include<iostream>
#include<string>
#define UE 0
#define SHITA 1
#define MIGI 2
#define HIDARI 3
#define N_U_MIGI 4
#define N_S_MIGI 5
#define N_U_HIDARI 6
#define N_S_HIDARI 7
using namespace std;

const int MAX_N = 260;
void loop(string v[], int y, int x, int type, int n, int deep);
int tmp;

int main(){
	int n;
	while(cin >>n){
		if(n == 0) break;
		string v[MAX_N];
		int max = 0;
		for(int i = 0; i < n; i++){
			cin >>v[i];
		}
		for(int i = 0; i < n; i++){
			for(int j = 0; j < n; j++){
				if(v[i][j] == '1'){
					int u, s, m, h, num, nsm, nuh, nsh;
					//cout <<"v[" <<i <<"][" <<j <<"] = 1" <<endl;
					
					tmp = 0; loop(v, i, j, UE, n, 0);
					u = tmp;
					
					tmp = 0; loop(v, i, j, SHITA, n, 0);
					s = tmp;
					
					tmp = 0; loop(v, i, j, MIGI, n, 0);
					m = tmp;
					
					tmp = 0; loop(v, i, j, HIDARI, n, 0);
					h = tmp;
					
					tmp = 0; loop(v, i, j, N_U_MIGI, n, 0);
					num = tmp;
					
					tmp = 0; loop(v, i, j, N_S_MIGI, n, 0);
					nsm = tmp;
					
					tmp = 0; loop(v, i, j, N_U_HIDARI, n, 0);
					nuh = tmp;
					
					tmp = 0; loop(v, i, j, N_S_HIDARI, n, 0);
					nsh = tmp;
					
					//cout <<"u + s = " <<u + s + 1 <<endl;
					//cout <<"m + h = " <<m + h + 1 <<endl;
					//cout <<"num + nsh = " <<num + nsh + 1 <<endl;
					//cout <<"nuh + nsm = " <<nuh + nsm + 1 <<endl;
					
					if(max < u + s + 1){
						max = u + s + 1;
					} if(max < m + h + 1){
						max = m + h + 1;
					} if(max < num + nsh + 1){
						max = num + nsh + 1;
					} if(max < nuh + nsm + 1){
						max = nuh + nsm + 1;
					}
					//cout <<"max = " <<max <<endl;
					
				}
			}
		}
		cout <<max <<endl;
	}
	return 0;
}

void loop(string v[], int y, int x, int type, int n, int deep){
	int plusx[8] = {0, 0, 1, -1, 1, 1, -1, -1}, plusy[8] = {-1, 1, 0, 0, -1, 1, -1, 1};
	if(x < 0 || y < 0 || x >= n || y >= n || v[y][x] == '0'){
		//cout <<"x = " <<x <<" y = " <<y <<" deep - 1 = " <<deep - 1 <<endl;
		tmp += (deep - 1);
	} else{
		loop(v, (y + plusy[type]), (x + plusx[type]), type, n, deep + 1);
	}
}