#include<iostream>
#include<string>
using namespace std;

char s[257][257];
int n;

int check(int i, int j)
{
	int ii, jj;
	int count;
	count = 0;
	for (ii = 1; ii < n-i; ii++) if (s[i+ii][j]=='0') break;
	if (ii>count) count = ii;
	for (jj = 1; jj < n-j; jj++) if (s[i][j+jj]=='0') break;
	if (jj>count) count = jj;
	for (ii = 1, jj = 1; ii < n-i && jj < n-j; ii++, jj++) if (s[i+ii][j+jj]=='0') break;
	if (ii>count) count = ii;
	for (ii = 1, jj = 1; ii <= i && jj < n-j; ii++, jj++) if (s[i-ii][j+jj]=='0') break;
	if (ii>count) count = ii;
	return count;
}

int main()
{
	int i, j;
	int max, t;
	while (scanf("%d",&n)!=EOF, n) {
		for (i = 0; i < n; i++) scanf("%s",s[i]);
		max = 0;
		for (i = 0; i < n; i++)
			for (j = 0; j < n; j++) {
				if (s[i][j]=='1') {
					t = check(i, j);
					if (max < t) max = t;
				}
			}
		printf("%d\n",max);
	}
	return 0;
}