#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<n;i++)
//#define int long long
using namespace std;

int n;
char grid[255][255];
int dp_lu[255][255];	//lu:left up
int dp_u[255][255];		//u:up
int dp_ru[255][255];	//ru:right up
int dp_l[255][255];		//l:left

signed main()
{
	while (true)
	{
		cin >> n;
		if (n == 0) break;
		rep(i,n) cin >> grid[i];

		int ans = 0;

		rep(i,n) rep(j,n)
		{
			if (i == 0)
			{
				if (grid[i][j] == '1')
				{
					dp_lu[i][j] = 1;
					dp_u[i][j] = 1;
					dp_ru[i][j] = 1;
					if (j == 0)
					{
						dp_l[i][j] = 1;
					} else {
						dp_l[i][j] = dp_l[i][j - 1] + 1;
					}
				} else {
					dp_lu[i][j] = 0;
					dp_u[i][j] = 0;
					dp_ru[i][j] = 0;
					dp_l[i][j] = 0;
				}
			} else if (j == 0) {
				if (grid[i][j] == '1')
				{
					dp_lu[i][j] = 1;
					dp_u[i][j] = dp_u[i - 1][j] + 1;
					dp_ru[i][j] = dp_ru[i - 1][j + 1] + 1;
					dp_l[i][j] = 1;
				} else {
					dp_lu[i][j] = 0;
					dp_u[i][j] = 0;
					dp_ru[i][j] = 0;
					dp_l[i][j] = 0;
				}
			} else if (j == n - 1) {
				if (grid[i][j] == '1')
				{
					dp_lu[i][j] = dp_lu[i - 1][j - 1] + 1;
					dp_u[i][j] = dp_u[i - 1][j] + 1;
					dp_ru[i][j] = 1;
					dp_l[i][j] = dp_l[i][j - 1] + 1;
				} else {
					dp_lu[i][j] = 0;
					dp_u[i][j] = 0;
					dp_ru[i][j] = 0;
					dp_l[i][j] = 0;
				}
			} else {
				if (grid[i][j] == '1')
				{
					dp_lu[i][j] = dp_lu[i - 1][j - 1] + 1;
					dp_u[i][j] = dp_u[i - 1][j] + 1;
					dp_ru[i][j] = dp_ru[i - 1][j + 1] + 1;
					dp_l[i][j] = dp_l[i][j - 1] + 1;
				} else {
					dp_lu[i][j] = 0;
					dp_u[i][j] = 0;
					dp_ru[i][j] = 0;
					dp_l[i][j] = 0;
				}
			}
			ans = max(ans, dp_lu[i][j]);
			ans = max(ans, dp_u[i][j]);
			ans = max(ans, dp_ru[i][j]);
			ans = max(ans, dp_l[i][j]);
		}

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