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

int check(vector<string> s, int i, int j, int n)
{
	if (s[i][j]=='0') return 0;
	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 n, i, j;
	int max, t;
	vector<string> s;
	while (cin>>n, n) {
		s.clear();
		s.resize(n);
		for (i = 0; i < n; i++) cin>>s[i];
		max = 0;
		for (i = 0; i < n; i++)
			for (j = 0; j < n; j++) {
				t = check(s, i, j, n);
				if (max < t) max = t;
			}
		cout<<max<<endl;
	}
	return 0;
}