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

string s[1000];
int N, dx[] = {0, 1, 1, -1}, dy[] = {1, 0, 1, 1};

int search(int sx, int sy, int dx, int dy)
{
	int n = 0;
	int x = sx, y = sy;
	while(x >= 0 && x < N && y >= 0 && y < N && s[y][x] == '1')
	{
		n++;
		x += dx; y += dy;
	}
	return n;
}

int main() {
loop:
	cin >> N;
	if(!N)
	return 0;
	for(int i = 0; i < N; i++)
		cin >> s[i];
		
	int a = 0;
	for(int y = 0; y < N; y++)
	{
		for(int x = 0; x < N; x++)
		{
			for(int i = 0; i < 4; i++)
				a = max(a, search(x, y, dx[i], dy[i]));	
		}
	}
	cout << a << endl;
	goto loop;
}